Quick tip: What to do when Visual Studio freaks out and everything is red

.NET, Technical stuff, Visual Studio, Work
See comments
Update: There is a fix available for this issue. See this post!

You might have seen this before: You open a project in Visual Studio, and almost every possible keyword is underlined red. Building works just fine, but the editor and Intellisense just freak out. In my case, working in a Windows Phone project, I couldn’t select the target (Device, Emulator 512, etc) in the combo box next to the “Run” button in the taskbar. It only showed “Start”.

Having just installed Xamarin, I first thought that it was the culprit. Or maybe Resharper. Anyway whatever the cause was (and I am still not 100% sure what actually triggered this behavior), recovering from it is actually quite easy:

  • Close Visual Studio
  • Delete the SUO file
  • Restart Visual Studio.

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. Personally I hate this file because it can cause a lot of trouble if it gets corrupted. And since it is hidden, you don’t always think about it.

So the rule is: If you see some weird behavior in Visual Studio, try to delete the SUO file first, before you try anything else.

Update:  I was just told that unloading and reloading the project file might help too. I suspect that under the cover this also modifies the SUO file and solves the issue. Good to know :)

Cheers
Laurent

Previous entry | Next blog entry

Responses to “Quick tip: What to do when Visual Studio freaks out and everything is red”

  1. Rene Schulte Says:

    If present also delete the .sdf file for native projects. It’s the Intellisense cache.
    Also clear the build output folders bin and obj. And if it does not help either, remove the .user files of the projects.
    :)

  2. Dennis Vroegop Says:

    I’ve had exactly the same thing, but deleting SUO didn’t help. Upgrading the Android SDK in Xamarin Studio to the latest version, however did fix these issues. I don’t see what the connection is between these two but apparently there is one…

  3. Andrei Dzimchuk Says:

    Recently have had a similar issue. The solution built without a problem but ReSharper was all red reporting errors like ‘can’t resolve symbol’ even if those symbols were declared in the same file.

    Deleting R# cache and .suo didn’t help but unloading projects and then reloading them one by one actually solved the problem.

    Man, I’ve lost tons of time fighting it though :) Thanks for the post!

  4. Dennis van der Pool Says:

    Thanks, worked great! :)

  5. suoer Says:

    The suo file was in a hidden “.vs” directory in my VS2015 C# project.
    Deleting the directory fixed the intellisense issue I was having where it refused to recognize some types I swapped the names of. (Restarting VS2015 did not help previously).

  6. subash Says:

    I had installed vs 2015 and on starting new win app project it says visual c# 2015 could not be created . can anyone help me.

  7. stelios Says:

    i was getting intellisense errors about wpf dependency properties ( but application was working fine)

    ————————————————
    Unload and reload project was fixed my problem
    ————————————————

  8. stelios Says:

    i am happy now :)

  9. Suzy Says:

    Resharper|Options|Environment|General|Clear Caches fixed this problem for me

  10. Teacha Says:

    Changing the .NET Target Framework to 4.5.2 in the Project Properties is what worked for me.

  11. Shaunak Says:

    Thanks for the post.

    Adding to the votes:
    – Deleting suo did not help
    – Restarting VS did not help
    – Unloading and reloading the project solved the issue!

  12. Let it burn Says:

    Nothing helps.

    I remember having those weird, unexplainable XAML errors back in 2012.

    6 years and they’re still unable to fix the #*%&@! thing once and for all.

    Well done M$.

  13. AndyP Says:

    +1 for Shaunak! Unloading and reloading the project worked for me too. An hour of Googling solutions and trawling Stack Overflow got me nowhere!

Comments for Quick tip: What to do when Visual Studio freaks out and everything is red