Skip to content

JavaScript coloring does not work in all .cshtml files #8864

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
In some .cshtml files, JavaScript coloring does not work.

Examples:

Working
image.png

Not working
image.png

Both files are partial views. Checked code syntax - everything is good.
Tried re-opening file - nothing.
Tried solutions in this SO thread - nothing. (https://stackoverflow.com/questions/78189420/syntax-highlighting-visual-studio-2022-in-cshtml-files-not-working)


Original Comments

Feedback Bot on 11/11/2025, 00:44 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Jonas Gucu on 11/12/2025, 05:12 AM:

After a bit of experimentation, it looks like sometimes C# code breaks the rest of the code.
In this case it’s an if statement not having curly braces.

Working example:
Image

Not working example:
Image

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions