dotnet / dotnet/roslyn

Razor syntax coloring treating everything in quotes as string

Open
#85,649 2 comments 1 reaction 1 assignee Claimed by @davidwengier View on GitHub
Area-Razor
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Razor-syntax-coloring-treating-everythin/11069472)._

---
\[severity:It’s more difficult to complete my work\] \[regression\] \[worked-in:18.2.2\]
I recently updated to Visual Studio 18.4.3 from 18.2.2.

In a Razor page, when assigning a property value to markup inside a `@{...}` razor code section, the syntax highlighting is treating everything in quotes as a string instead of using the C# syntax coloring rules. If the markup is NOT in a property assignment then the coloring is correct.

Here is an oversimplified example using the `Cool Slate` Theme and `Cascadia Code Semi-bold` Font. You can see that `"inputValue"` is colored correctly (white) in the first two `<InputBox>` sections, but the 3rd and 4th that are property assignments are not (redish-orange).

Image

The correct coloring I mentioned was present in the previous versions, just after the update is it all now skewed. From some reading I have done I think it may be related to the recent change to move from the separate Razor Language Server to being integrated and cohosted with Roslyn.

---
### Original Comments

#### Feedback Bot on 03/04/2026, 01:51 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.