'Visual Studio showing false errors

I was working on a project, and I usually before doing anything I create new branches.

In my feature branch, Visual Studio wasn't showing any errors. It was doing all good.

Well, I switched from my feature branch to my develop branch and it shows me errors when it didn't before.

But there are no errors, since I build the solution and it succeeds. It runs perfectly.

enter image description here enter image description here

First time this actually happens to me. :/



Solution 1:[1]

It's because VS uses for editor other implementation then while building, and sometimes it fails to follow files modification. Sometimes it helps to reopen the solution, sometimes you should close the solution, remove cache files (they should be a file or subdirectory next to the solution file) and reopen the solution.

Solution 2:[2]

You may try to clean the solution, sometimes i have ese problema and that is the solution. Go to Build>Clean Solution.

I hope this can resolve your problem.

Solution 3:[3]

This happened to me when the .NET Framework for the referenced project was higher than the referencing project.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 max630
Solution 2 Isaias Rodriguez
Solution 3 Edward Bagby