Skip to content

feat: support DebuggerDisplay #226

@GustavEikaas

Description

@GustavEikaas

Description

I think DebuggerDisplay support would be a massive improvement to netcoredbg. https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerdisplayattribute?view=net-10.0

Browsing lists/guid/dictionaries etc are very tedious today in a variable viewer. I tried to solve this in my debugger proxy using an interceptor and trying to simplify known types https://github.com/GustavEikaas/easy-dotnet-server/blob/main/EasyDotnet.Debugger/ValueConverters/ListValueConverter.cs this is obviously very hacky, fragile and hard to maintain.

If it's okay I can take a crack at trying to add DebuggerDisplay support? Seems like most of the fundamental building blocks are in place already. Thoughts? Any big known blockers for this?

EDIT
Ill just update this section below with information about how it works and which attributes netcoredbg has to respect

DebuggerDisplayAttribute

DebuggerDisplayAttribute controls the short value text shown for an object in the variables/watch UI.Instead of showing the raw fallback like { MyType }, the debugger can render a template such as Id = {Id}, Name = { Name} by evaluating members on the object.

Before: customer = { MyApp.Customer}
After: customer = Id = 42, Name = "Ada"

DebuggerBrowsableAttribute

DebuggerBrowsableAttribute controls whether a field or property appears when an object is expanded. It can hide noisy implementation details with Never, or request special expansion behavior such as RootHidden, where a member’s children are shown directly under the parent.

Before: list->_items-> [0], [1], [2]
After: list-> [0], [1], [2]

DebuggerTypeProxyAttribute

DebuggerTypeProxyAttribute tells the debugger to show a separate proxy type instead of the object’s raw internal layout.This is how collection types can expose a clean debugging view without changing their real runtime shape.

Before: dictionary->_entries, _buckets, _count, ...
After: dictionary-> [0] { Key = "one", Value = 1 }, [1] { Key = "two", Value = 2 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions