I am using Visual Studio 2022, and for a few different versions (of 2022) I have noticed that the symbol parsing (or whatever is responsible for this error message) is performing fairly poorly. I have two projects – one is a c++20 project, and the other is a managed .net 6 WinUI3 project. Both suffer from this really annoying issue where I get "The name xyz does not exist in the current context" in my editor, even when the symbol is absolutely defined and the build will succeed.
I know this is purely a VS error and not something wrong with my code. I have tried cleaning and rebuilding but to no avail. Is there any way to make the symbol parser realize it’s mistake?
I am using a pretty standard installation of community edition. I don’t have any plugins.
This is also happening on my work AND home machine – which don’t even share the same Microsoft account associated with them.
2
Answers
After multiple days of this highly annoying VS issue, through multiple IDE and even machine restarts, I was able to fix it by right-clicking the project and selecting unload, then right-clicking again to re-load.
For some reason I cannot comment because of my "reputation", so I will post an "Answer" which is not really an answer.
I came here with the same issue which started for me within the past 3 weeks. Unfortunately the unload/reload didn’t work for me.
My workaround initially was, close VS2022, open up the project file and delete or rename the .vs folder and reopen the project. This did work for me, but no longer does. Updated VS2022 today to latest version 17.9.2 and this is still a problem. My solution consists of 4 projects, WPF and .NET6.
I’ve read somewhere else in my searches that this is also a problem with VS Code, so I don’t think this is VS2022 issue per se. Perhaps a Rosyln issue?
All I know is that this is very annoying, I’m basically dead in the water since none of the controls are recognized and Intellisense doesn’t work due to all of the errors in the editor.
I must add though, that I can build and run the solution. Very odd.
Edit: I was able to solve this issue in VS2022. In my mainwindow.xaml file I was referencing a custom control in another project. I cleaned and built the user control project BEFORE opening the xaml and .cs file of the mainwindow project and all of the errors were not present.