Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't see primary constructor variables in debugger #74082

Open
eerhardt opened this issue Jun 20, 2024 · 0 comments · May be fixed by #74188
Open

Can't see primary constructor variables in debugger #74082

eerhardt opened this issue Jun 20, 2024 · 0 comments · May be fixed by #74188
Labels
Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@eerhardt
Copy link
Member

image

When in a debugger, and I'm not in an instance method, I can't see the value of c.x. I need to be able to see all of the members of c in order to debug issues with my code. Not being able to see these variables is important, especially when x is a reference to another class with a bunch of state on it, and I'm in a multi-threaded application where even F11'ing into the Print() method could cause that state to change from another thread.

Version Used: .NET SDK 8.0.302

Steps to Reproduce:

  1. Run the following code under a debugger and set a breakpoint on the c.Print(); line.
var c = new MyClass(5);

c.Print();


class MyClass(int x)
{
    private int y = 10;

    public void Print()
    {
        Console.WriteLine(x);
        Console.WriteLine(y);
    }
}
  1. View c in a Watch window, and try to inspect the value of c.x.

Expected Behavior:

I should be able to see all the members of c in the Watch window. (I'd even accept if this isn't the default behavior of the debugger, and I had to turn a Debug => Options switch on/off to enable it. I do that already with "Enable Just My Code")

Actual Behavior:

I can only see c.y's value in the Watch window.

cc @KathleenDollard

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant