Repository navigation
[dotnet watch] Add --trace command line switch - #56008
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a89a64b5-e312-44e2-8650-9e2e0906dee8
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds an explicit --trace switch to dotnet watch to enable LogLevel.Trace, keeps --verbose as LogLevel.Debug, and removes the prior special-casing where DOTNET_CLI_CONTEXT_VERBOSE=trace enabled Trace logging.
Changes:
- Add
--traceoption to thedotnet watchCLI (including mutual-exclusion validation with--quiet/--verbose). - Stop interpreting
DOTNET_CLI_CONTEXT_VERBOSE=traceasLogLevel.Trace(now only boolean ->LogLevel.Debug). - Update test utilities and command-line parsing tests to use/validate
--trace, plus add localized help text.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs | Switch test harness default from env-var trace to --trace, and remove env-var injection. |
| test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs | Add coverage for --trace parsing and conflicts with other log-level options. |
| src/Dotnet.Watch/Watch/Context/EnvironmentVariables.cs | Remove trace string handling from DOTNET_CLI_CONTEXT_VERBOSE mapping. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.zh-Hant.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.zh-Hans.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.tr.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.ru.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.pt-BR.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.pl.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.ko.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.ja.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.it.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.fr.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.es.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.de.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/xlf/Resources.cs.xlf | Add localized help entry for Help_Trace. |
| src/Dotnet.Watch/dotnet-watch/Resources.resx | Add Help_Trace resource string used by --trace option help text. |
| src/Dotnet.Watch/dotnet-watch/CommandLine/DotnetWatchCommandDefinition.cs | Define/register --trace option and enforce mutual exclusion with other log-level options. |
| src/Dotnet.Watch/dotnet-watch/CommandLine/CommandLineOptions.cs | Map --trace to LogLevel.Trace during options parsing. |
Suppressed comments (1)
src/Dotnet.Watch/dotnet-watch/CommandLine/CommandLineOptions.cs:149
--tracesetsoptions.GlobalOptions.LogLeveltoTrace, butProgram.TryCreate(andAspireLauncher) currently usesenvironmentOptions.CliLogLevel ?? options.GlobalOptions.LogLevel. IfDOTNET_CLI_CONTEXT_VERBOSEis set (even justtrue), it forces Debug and will override--trace, so users can't actually get Trace output in that environment. Consider changing the effective log level selection to prefer the more-verbose of the two (e.g.,Tracewins overDebug) or to make explicit CLI flags override the environment setting.
var logLevel = parseResult.GetValue(definition.TraceOption)
? LogLevel.Trace
: parseResult.GetValue(definition.VerboseOption)
? LogLevel.Debug
: parseResult.GetValue(definition.QuietOption)
? LogLevel.Warning
: LogLevel.Information;
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a89a64b5-e312-44e2-8650-9e2e0906dee8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a89a64b5-e312-44e2-8650-9e2e0906dee8
|
🔍 Build Failure Analysis — the Please see the originating [Azure DevOps build]((dev.azure.com/redacted) for the authoritative build logs (this workflow reuses that build's binlogs and does not build locally). The GitHub Actions run has the fetch-step diagnostics.
|
551352e to
072515a
Compare
|
/backport to release/11.0.1xx |
|
Started backporting to |
|
@tmat backporting to |
|
Started backporting to |
Copilot-Session: a89a64b5-e312-44e2-8650-9e2e0906dee8
Adds an explicit
--traceswitch todotnet watchto enableLogLevel.Trace, keeps--verboseasLogLevel.Debug, and removes the prior special-casing whereDOTNET_CLI_CONTEXT_VERBOSE=traceenabled Trace logging.Changes:
--traceoption to thedotnet watchCLI (including mutual-exclusion validation with--quiet/--verbose).DOTNET_CLI_CONTEXT_VERBOSE=traceasLogLevel.Trace(now only boolean ->LogLevel.Debug).--trace, plus add localized help text.We intentionally separate controls of dotnet-watch log level (
--quiet,--verboseand--trace) from--verbosityoption that controls the verbosity of subcommands to separate diagnosing Hot Reload issues from diagnosing issues related to the subcommand (e.g. build, restore, etc.)