Search code examples
c#compiler-errorsvisual-studio-2017ide

100s of errors that all go away when I view them?


I have hundreds of errors saying type or namespace doesn't exist (some are types and some are namespaces). When I click to view the error it initially opens the file and shows the squiggly line under code in question, however within a second or two the squiggly line disappears and so does the error.

After I finish opening up all the files with "errors", all the errors disappear and it compiles fine. However, if I close any the files then the error reappears for that file.

This happened after I tried to merge branches. Not really sure how to proceed to find the root of the issue, or whether there even is a real issue... maybe this is just some bug in Visual Studio and I need to do something to clear some kind of cache to fix the problem?

Please advise.

Update:

I have tried all of tymtam's suggestions but to no avail.

However, after deleting the .vs folder, now the errors don't even go away when I open the files so I can no longer build by doing that either.

I am thinking the error may have something to do with dll versions or something like that but I have tried to rebuild and replace all dlls with latest ones and that hasn't helped either.


Solution

  • I did these two things to fix my problem:

    1. I used WinMerge to copy files from the old branch over everything in the new branch for the application in question.

    2. I updated the framework on the project to the latest version.

    Originally, I did those two steps except I used TFS to merge the old branch to the new (instead of using WinMerge to copy/overwrite files) and accepted the old version for all conflicts.

    This was the nuclear option as I lost any changes that were made in the new branch :(. I have a copy that I can use WinMerge to try to manually merge changes back in but it's definitely frustrating.