3

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;

    }

}

Debugger Watch Window

Willem
  • 302
  • 10
  • 1
    https://learn.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022 Report bugs like that to Microsoft. – Lex Li Dec 03 '22 at 01:55
  • Anyone know how I can find what the last version was before the update? – Willem Dec 03 '22 at 02:29

2 Answers2

2

It's a regression in 17.4 V.S.
WinForms repo issue: https://github.com/dotnet/winforms/issues/8354
Roslyn repo issue: https://github.com/dotnet/roslyn/issues/66109


Fixed in 17.4.5.

Kirsan
  • 254
  • 3
  • 5
0

I cannot reproduce this error according to the code. Maybe you can provide more information about StringParser to help us reproduce the problem and give more suggestions.

You can try to Refresh watch values: select the refresh icon, or press the spacebar or you can select Enable property evaluation and other implicit function calls in Tools > Options > Debugging > General and try again.

If they don't work you can report this on DC.

And if you want to rollback to the vs used before you can choose more > Rollback to previous version in vs installer: enter image description here

Jingmiao Xu-MSFT
  • 2,076
  • 1
  • 3
  • 10
  • Will review my code first as I have noticed with a new project no problem. A new project and copying in my code, all in one application project, same problem. Before reporting a bug I believe it's a must to exclude as many possibilities as possible. Exspecially as I am not a professional due to both, learning and not passing throu nonsense. If you say to post the code, no problem, I will do so and enter the link here to the new question. – Willem Dec 05 '22 at 20:21
  • 1
    Am not rolling back until I am sure. Have posted the code of `StringParser` here [Watch window CS0103 - follow up to exclude my code as problem](https://stackoverflow.com/questions/74694938/watch-window-cs0103-follow-up-to-exclude-my-code-as-problem) – Willem Dec 05 '22 at 22:09