Skip to content

A DebuggerTypeProxy whose constructor throws expands into the thrown exception's members #56

Description

@hexbinoct

Built from source at 293d77f (0.1.17), net10.0, Windows x64.

When a [DebuggerTypeProxy] constructor throws, the thrown exception's members are shown as the value's children.

[DebuggerTypeProxy(typeof(AngryProxy))]
sealed class Angry { public int Real = 1; }

sealed class AngryProxy
{
    public AngryProxy(Angry target) => throw new InvalidOperationException("no");
    public int Doubled => 2;
}

Expanding angry gives 26 children: _message, _stackTrace, _HResult, TargetSite, StackTrace, Source and the rest of System.Exception, with Real under Raw View.

Expected is something that says the proxy failed. Whatever you choose there, the value should not look like an exception object: nothing in the output distinguishes this from angry genuinely being an InvalidOperationException, and Raw View is easy to miss.

A proxy constructor that throws is not far-fetched, since a proxy usually reads the target eagerly in its constructor and any assumption it makes about state can be wrong at an arbitrary breakpoint.

Related, and possibly the same code path: Lazy<int> renders its CoreLib display as

ThreadSafetyMode = , IsValueCreated = True, IsValueFaulted = False, Value = 99

The Mode fragment comes out empty, and the booleans render as True and False where the same values as ordinary variables render true and false. So the fragment renderer is not the value renderer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions