Skip to content

fix(#45761): Stop forwarding dotnet-watch run arguments to all commands#50558

Closed
ronald-mz wants to merge 5 commits intodotnet:release/10.0.1xxfrom
ronald-mz:fix_runtime_options_during_watch
Closed

fix(#45761): Stop forwarding dotnet-watch run arguments to all commands#50558
ronald-mz wants to merge 5 commits intodotnet:release/10.0.1xxfrom
ronald-mz:fix_runtime_options_during_watch

Conversation

@ronald-mz
Copy link
Contributor

Fixes: #45761, #45634, and maybe a regression of #34949.

Context

Watch CLI

dotnet watch [<command>]
  [--list]
  [--no-hot-reload] [--non-interactive]
  [--project <PROJECT>]
  [-q|--quiet] [-v|--verbose]
  [--version]
  [--] <forwarded arguments> 

dotnet watch -?|-h|--help

Problem

dotnet-watch has -p, --project, --launch-profile, and --no-launch-profile as possible arguments. A user can not use these arguments without dotnet-watch forwarding them. These arguments only work with the run command, and will cause an error if passed to any command but run.

@ronald-mz ronald-mz requested review from a team and tmat as code owners August 30, 2025 05:01
@ronald-mz ronald-mz changed the title fix(#45761): Stop passing arguments meant for dotnet-watch to all commands fix(#45761): Stop forwarding dotnet-watch arguments to all commands Aug 30, 2025
@ronald-mz
Copy link
Contributor Author

@dotnet-policy-service agree

@ronald-mz ronald-mz changed the title fix(#45761): Stop forwarding dotnet-watch arguments to all commands fix(#45761): Stop forwarding dotnet-watch run arguments to all commands Aug 30, 2025
var optionResult = (OptionResult)child;

// skip watch options:
if (!watchOptions.Contains(optionResult.Option))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inverting the logic allows a continue to short-circuit the loop.

@tmat
Copy link
Member

tmat commented Jan 6, 2026

@ronald-mz Would you mind rebasing to release/10.0.2xx branch?
If you prefer I can take over and complete the work.

@tmat
Copy link
Member

tmat commented Jan 9, 2026

I'm going to complete this to get the fix to 10.0.2xx

@tmat
Copy link
Member

tmat commented Jan 9, 2026

Superseded by #52387

@tmat tmat closed this Jan 9, 2026
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.

3 participants