Am using:
Visual Studio Community 2022 (64-bit), Version 17.4.2
with
.NET Framework, Version 4.8.09032.
There was an update yesterday, 02-12-2022, with I installed through the 'Visual Studio Installer'.
After this I can't watch local variables in the 'Watch' window while debugging. It gives me a CS0103 error (see image below).
Also in the window 'Locals' they do not appear.
(edit: Have posted the code of StringParser
here Watch window CS0103 - follow up to exclude my code as problem)
The solution is very simple, it consists out of two projects:
Windows Forms App (.NET Framework)
Windows Forms Control Library (.NET Framework)
The latter is linked to the first ofcourse. The control library contains StringParser
.
Basically, the next code is all of the forms project. It is just test code while creating the StringParser
. Prior to the update, this worked fine, as is when having parser
as global of the Form1
.
When declaring the local variable parser
and instantiating it as global of the Form1, there is no CS0103
on that variable.
The next two questions adresses this problem.
VS 2015 Update 2 - Variable does not exist when debugging, why?
Error CS0103 when debugging most variables in Visual Studio 2019
While I suspect the first does describe my situation. Haven't tried the solution as it is a different version.
The second does not adress this issue.
public Form1()
{
InitializeComponent();
StringParser parser = new StringParser();
parser.Content = filecontent;
string token = "";
while (!parser.Next('<'))
{
parser.Next('>');
token = parser.Token;
}
}