Skip to content

VS debugger variable expansion is broken by nullable ref-returning properties #81763

@kindermannhubert

Description

@kindermannhubert

Version Used:
VS 18.1.1

Steps to Reproduce:
Set a breakpoint after the following code, run, and when the breakpoint is hit, try to expand c1/c2/c3/c4 variables in Watch/Locals/Autos windows or by hovering over the variable with a cursor. Expansion of c1/c2/c3 works as expected, but c4 cannot be expanded, although C4 and C2 differ only in used type (int? vs int).

class C1
{
    public int A = 1;
}

class C2
{
    public int A = 1;
    public ref int B => ref A;
}

class C3
{
    public int? A = 1;
}

class C4
{
    public int? A = 1;
    public ref int? B => ref A;
}

var c1 = new C1();
var c2 = new C2();
var c3 = new C3();
var c4 = new C4();

Expected Behavior:
All instances c1/c2/c3/c4 can be expanded.

Actual Behavior:
c4 cannot be expanded.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions