Search code examples
visual-studiorazorvisual-studio-2022

Visual Studio 2022 don't display errors on .cshtml files


I just installed VisualStudio 2022 some days ago and I realized that it is not showing me the errors that I made in the views (.cshtml files) for example something simple as:

@{
 var MyNumber = 1;
 mynumber = 3
}

Visual studio doesn't recognize the variable that does not exist or that the assign does not end with ';' and then it doesn't underline it or remark it in red and It's very annoying to be honest. It does not happen for my old instance VS2017

VS2022: Code Image from VS2022 VS2017: Code Image from VS2017

I've been researching about and already tried solutions like delete the .suo file or the .vs folder on the project. Also tried clearing Cache, even reinstalling Visual Studio like 3 times.

If anyone could help me it would be pretty awesome.


Solution

  • The problem disappeared after updating the Visual Studio (VS).