2

I've been testing some c# code in visual studio and when I opened visual studio this morning my project was full of red lines.

  • Demanding class declarations to be closed with End class
  • Red lines under semicolons
  • Variable declaration without an AS clause
  • Ctrl+K, CTRL+C Gives visual basic comments E.g. 'green text
  • //C# comments get red squiggly lines under them.

These are clearly visual basic errors which means for some reason it's trying to make my C# into VB.

I've been trying to find out what on earth to search for but no luck so far.

When I build the project there is no problem. Just the syntax errors in visual studio with red squiggly lines.

Stian
  • 57
  • 1
  • 6
  • If you create a new C# project (new instance of VS, new solution), does it do the same in that? Also, what version/edition of Visual Studio? Have you already e.g. attempted to run a repair on it? – Damien_The_Unbeliever May 05 '17 at 11:59
  • It did not happen in a new project. Though I'm uncomfortable not knowing what caused it. – Stian May 05 '17 at 12:25

1 Answers1

0

Have you try to :

  • close VS
  • delete .SUO file
  • restart VS

The SUO file is a hidden file,, which is placed in the same folder as the SLN file. It contains a lot of information such as which files are currently open in the IDE, some local settings, etc.

More Information about that.

Francois Borgies
  • 2,378
  • 31
  • 38
  • Restarting helped but it did so before and then snapped back to the problem so I expect it might do so again. There is a small dropdown above the code to the upper left that says "Miscellaneous files" with a c# icon to it's left. When that is there the code is fine. After a while something happends and it changed to 1_filename.aspx.cs and then to 2_filename.aspx.cs and I have no idea what i did but the errors were back. – Stian May 05 '17 at 12:23
  • Miscellaneous files means VS doesn't recognize your file as a part of your project. So you can try to exclude this file in Solution Explorer, Right click on your projetc folder, Add, Existing file and select your file. – Francois Borgies May 05 '17 at 12:35