Skip to content

Fix dotnet test validation with explicit paths - #56375

Merged
Evangelink merged 6 commits into
mainfrom
dev/amauryleve/dotnet-test-cli-isolation
Sep 24, 2026
Merged

Evangelink merged 6 commits into
mainfrom
dev/amauryleve/dotnet-test-cli-isolation

Conversation

@Evangelink

@Evangelink Evangelink commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

dotnet test provides helpful validation when a project, solution, directory, or test module is passed as a non-first unmatched argument. That validation is misleading when an explicit build path such as --project is already present, because subsequent unmatched tokens belong to the test application and may legitimately name an existing path.

This change keeps positional inference and duplicate-path validation intact, but skips the non-first path diagnostic when --project, --solution, or --test-modules has already selected the build input. As a result, extension option values behave consistently with and without the -- separator.

Coverage includes the end-to-end --project scenario from #56369 in both forms, plus direct parser cases for all three explicit build-path options with and without the separator. Existing validation tests continue to verify the helpful diagnostics when no explicit build path is supplied.

Related to #56338. The .NET 10 servicing fix is in #56374.

Evangelink and others added 5 commits September 21, 2026 13:32
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 12:02
@Evangelink
Evangelink requested a review from a team as a code owner September 22, 2026 12:02
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add equivalent regression coverage for --solution and --test-modules.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Updates dotnet test validation so forwarded project-like arguments are not misclassified when an explicit build path is supplied.

Changes:

  • Suppresses misleading diagnostics for explicit project, solution, or test-module paths.
  • Adds regression coverage for --project with and without --.
File Summary
test/​dotnet.Tests/​CommandTests/​Test/​GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs Adds regression tests for forwarded project-like arguments.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​TestCommandOptions.cs Adjusts positional-path validation for explicit build options.

Comment thread src/Cli/dotnet/Commands/Test/MTP/TestCommandOptions.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Evangelink

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

@Evangelink
Evangelink enabled auto-merge (squash) September 23, 2026 20:48
@Evangelink
Evangelink merged commit 50c1b1e into main Sep 24, 2026
35 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/dotnet-test-cli-isolation branch September 24, 2026 07:34
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 25, 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