Search code examples
visual-studio-2022syntax-highlighting

Visual Studio 2022 doesn't recognise and color syntax


Recently I've got new corporate laptop and since then my Visual Studio Professional 2022 fails at recognising and coloring some code syntax. For example classes, methods etc. in text editor are simply black:

Class color fail

enter image description here

Method call color fail

Here are some more details and my findings so far:

  • It's irregular. Within one .cs file some of the syntax may be colored and some not
  • It impacts both user types and .NET libraries
  • Sometimes while using the studio screen refreshes and coloring starts/ceases to work
  • It impacts various project with no difference i.e. old legacy .NET Framework projects, recent .NET 6.0, backend, frontend
  • Manual setting of coloring doesn't help. Color change can be observed when under coursor but in text editor still black
  • OS is W10
  • My teammates use same version of Studio, same projects and no problem. Some people face some challenges with Studio and Intellisene but not with coloring
  • What I tried so far: clean reinstall of Visual Studio, delete .vs folder, switch light/dark mode, reset all settings, play with various editor settings, update Visual Studio
  • I also raised a ticket with Microsoft but don't have much hope for their support

Would appreciate any help. Currently the issue is so annoying and disturbing that I had to switch to JetBrains Rider. Ran out of ideas, my last overkill try would be to format drive and resetup entire OS.


Solution

  • It turned out that it is actual bug in Visual Studio. MS replied to my ticket. Installed new preview version (17.11) and it works now. Thanks everybody for help. Here is explenation what did they change in roslyn:

    https://github.com/dotnet/roslyn/pull/72878