Skip to content

Fix dotnet test validation with explicit paths - #56369

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

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

Conversation

@Evangelink

@Evangelink Evangelink commented Sep 21, 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 project file.

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.

The end-to-end test runs a real Microsoft.Testing.Platform project with an explicit --project and forwards --filter TestProject.csproj in both forms. 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 3 commits September 21, 2026 13:32
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 21, 2026 19:14
@Evangelink
Evangelink requested a review from a team as a code owner September 21, 2026 19:14
@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

🟢 Approval recommended

The regression coverage is complete and no blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Adds end-to-end regression coverage for dotnet test argument isolation after --.

Changes:

  • Tests forwarding --filter TestProject.csproj to Microsoft.Testing.Platform.
  • Verifies successful execution without erroneous project validation.
File Description
test/​dotnet.Tests/​CommandTests/​Test/​GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs Adds separator-aware argument isolation regression coverage.

@Evangelink
Evangelink enabled auto-merge (squash) September 22, 2026 11:43
@Evangelink Evangelink changed the title Add dotnet test argument isolation regression coverage Test dotnet test argument isolation after -- Sep 22, 2026
@Evangelink
Evangelink merged commit f049c11 into main Sep 22, 2026
28 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/dotnet-test-cli-isolation branch September 22, 2026 11:52
@Evangelink Evangelink changed the title Test dotnet test argument isolation after -- Fix dotnet test validation with explicit paths Sep 22, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 23, 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.

4 participants