Skip to content

Prevent debugger inspection from initializing argument arity - #2862

Open
zjdangge wants to merge 1 commit into
dotnet:mainfrom
zjdangge:codex/argument-debugger-view
Open

zjdangge wants to merge 1 commit into
dotnet:mainfrom
zjdangge:codex/argument-debugger-view

Conversation

@zjdangge

Copy link
Copy Markdown

Inspecting an argument in the debugger can initialize its cached arity before the argument has been added to a command or given a default value. Later parsing then uses the premature value and can report a missing required argument.

Add a debugger proxy that computes the displayed arity without caching it. Explicitly configured and already initialized arities are displayed as stored, while the normal Arity getter retains its existing behavior. The proxy also exposes the argument's metadata and the existing validator and completion collections without initializing them.

Fixes #2704.

Validation: the two regression cases for inspection before configuration failed before the fix. All 14 argument tests now pass, including explicit and previously initialized arity cases. The tests instantiate the proxy selected by DebuggerTypeProxyAttribute and verify subsequent parsing; no manual IDE debugger session was performed. A Windows Debug solution build completed with no warnings or errors, and all five test assemblies passed (1,949 passed, 14 existing skips), including the main tests on .NET 10 and .NET Framework 4.7.2. Release, Linux, and macOS were not run locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Argument.Arity modify internal state on first get access.

1 participant