Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/sdkPublic

Auto-enable DOTNET_CLI_CONTEXT_VERBOSE for diagnostic verbosity#52222

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge8 commits intorelease/10.0.2xx
base:release/10.0.2xx
Choose a base branch
Loading
fromcopilot/configure-cli-verbosity-settings

Conversation

Copy link
Contributor

CopilotAI commentedDec 16, 2025
edited
Loading

  • Refactor to use System.CommandLine Option Action
  • Create ApplyVerbosityAction class
  • Add Action to all VerbosityOption definitions
  • Revert all command-specific changes
  • Fix Terminating property to false
  • Verify Action is invoked correctly
  • Test the implementation across multiple commands
  • Address code review feedback
  • Remove debug comments
  • Simplify Action by passing option reference
  • Final testing complete

Implementation Complete

The solution uses System.CommandLine's Option Action mechanism with a generic Action class that receives the option reference directly. This allows cleaner code usingparseResult.GetValue(verbosityOption) as suggested by@baronfel.

Verified working:

  • dotnet build -v diag
  • dotnet restore -v diagnostic
  • dotnet build -v normal (does not set variable) ✓
Original prompt

Can you look through all of the CLI commands, find those that have a verbosity, and if verbosity is set to diag, please also configure verbose details that is also controlled by DOTNET_CLI_CONTEXT_VERBOSE.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

CopilotAIand others added3 commitsDecember 16, 2025 22:03
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
…n accessCo-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
CopilotAI changed the title[WIP] Configure CLI commands for verbosity settingsAuto-enable DOTNET_CLI_CONTEXT_VERBOSE for diagnostic verbosityDec 16, 2025
@baronfel
Copy link
Member

@copilot a solution that requires every command to remember to call some method is not workable - instead you should use theAction of the common verbosity option to carry this 'set the env var logic'. You can give an Option anAction that System.CommandLine will call during invocation of the parsed command if that Option is part of the result set.

Doing this keeps the behavior consistent across all commands that use the verbosity.

Per@baronfel's feedback, moved verbosity handling to an Action on theVerbosityOption itself. This eliminates the need for each command tomanually call ApplyVerbosityOptions(). The Action is attached to allVerbosityOption variants and will be invoked by System.CommandLinewhen the option is parsed.Changes:- Added ApplyVerbosityAction class in CommonOptions- Added Action property to all VerbosityOption definitions- Reverted all command-specific verbosity handling code- Kept IsDiagnostic() extension method for reuseCo-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copy link
ContributorAuthor

@copilot a solution that requires every command to remember to call some method is not workable - instead you should use theAction of the common verbosity option to carry this 'set the env var logi...

I've refactored the implementation to use the Option Action pattern as you suggested. The ApplyVerbosityAction is now attached to all VerbosityOption definitions in CommonOptions, and all the per-command calls have been reverted (commit47b9106).

However, I'm finding that the Action doesn't appear to be invoked during testing. Could you clarify when System.CommandLine invokes Option Actions? Is there something specific I need to do to ensure the Action is called when the option is parsed?

CopilotAIand others added2 commitsDecember 16, 2025 22:56
The Action needs Terminating = false so that command executioncontinues after the action runs. Verified that DOTNET_CLI_CONTEXT_VERBOSEis now properly set to "True" when using -v diag or -v diagnostic acrossbuild, restore, and other commands.Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
- Removed commented debug statements- Simplified success case in enum parsing- All functionality remains working as verified by testsCo-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
@baronfel
Copy link
Member

@copilot the 'pre-actions' are collected during parsinghere, and then invoked sequentially during command invocationhere.

your implementation of the action needs to change slightly - you don't need to do all of this work to get the verbosity, you can just directly fetch the value from the parse result. If the action is being invoked you canassume that the verbosity is in the parse result. if you pass a reference to the verbosity option to the Action, then you can do something likeif (parseResult.GetValue(verbosityOption).IsDiagnostic()) { ... }

Per@baronfel's feedback, refactored ApplyVerbosityAction to acceptthe verbosity option as a constructor parameter. This allows directuse of parseResult.GetValue(verbosityOption) instead of searchingthrough all children.Changes:- Made ApplyVerbosityAction generic to handle both VerbosityOptions  and VerbosityOptions? types- Pass option reference to Action constructor- Simplified Invoke logic to directly get value from parse result- Changed HiddenVerbosityOption from field to property to support  proper initialization with ActionVerified working with dotnet build/restore -v diagCo-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copy link
ContributorAuthor

@copilot the 'pre-actions' are collected during parsinghere, and then invoked seq...

Updated the implementation to pass the option reference to the Action as you suggested (commite7a82e7). The Action now usesparseResult.GetValue(verbosityOption) directly instead of searching through all children. Made the Action generic to handle bothVerbosityOptions andVerbosityOptions? types. Verified working withdotnet build -v diag anddotnet restore -v diagnostic.

Copy link
Member

@baronfelbaronfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This LGTM - the CI failure is the WinRT known issue

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

Reviewers

@baronfelbaronfelbaronfel approved these changes

@marcpopMSFTmarcpopMSFTAwaiting requested review from marcpopMSFT

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@baronfel@marcpopMSFT

[8]ページ先頭

©2009-2025 Movatter.jp