Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio compiles fine, but it still shows red lines

I am using Visual Studio 2012 and it was working all fine until I started observing some funny behavior. When I open my code it shows red Underlines which we usually see when there is an error in our code. Surprisingly, the code compiles all fine. I have made following observations that are not normal at all.

  1. Red underlines in the code
  2. While cleaning or building the solution no error.
  3. Red underlines go away for some time after I build/clean the solution, but they come back eventually.
  4. Because of this, my IntelliSense stopped working.
  5. I can not right click on any component and go to its definition.

Any ideas?

like image 849
Lost Avatar asked Oct 04 '22 06:10

Lost


People also ask

How do you get rid of red lines in VS code?

OR press CTRL+SHIFT+P and search for the option 'Enable Error Squiggle' and just click on it. That's it! If you want to Disable Red Wavy underlines showed after syntax error, just Follow the above procedure and search for 'Disable Error Squiggle' and click on it.

How do I check Visual Studio for errors?

To display the Error List, choose View > Error List, or press Ctrl+\+E.


2 Answers

Visual Studio 2017, Visual Studio 2022:

Closing Visual Studio and removing the .vs folder located in the solution directory worked for me.

This folder has a hidden attribute. You may need to change settings in folder options to show hidden files.

like image 144
VeganHunter Avatar answered Oct 19 '22 05:10

VeganHunter


Delete the contents of the temporary ASP.NET folder and then rebuild. It'll either be in your user folder (for IIS Express - \AppData\Local\Temp\Temporary ASP.NET Files) or the Windows directory (for IIS - C:\Windows\Microsoft.Net\Framework\vx.xx\Temporary ASP.NET Files)

Paths are off the top of my head and may not be correct

like image 29
levelnis Avatar answered Oct 19 '22 06:10

levelnis