Repository navigation
[release/11.0.1xx-rc2] Fix dotnet test validation with explicit paths - #56390
Merged
Evangelink merged 1 commit intoSep 24, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
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. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Ports explicit-build-path validation fixes to the RC2 dotnet test implementation.
Changes:
- Allows forwarded path-like arguments when explicit build paths are specified.
- Adds parser and end-to-end coverage with and without
--.
| File | Description |
|---|---|
test/dotnet.Tests/CommandTests/Test/TestCommandParserTests.cs |
Adds parser coverage for explicit build-path options. |
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs |
Adds end-to-end project forwarding coverage. |
src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs |
Adjusts explicit build-path validation behavior. |
Evangelink
enabled auto-merge (squash)
September 24, 2026 09:35
azat-msft
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[release/11.0.1xx-rc2] Fix dotnet test validation with explicit paths
Align no-separator MTP argument handling across .NET 10, RC2, and main.
Description
The exact #56338 scenario, where test application arguments follow
--, is already fixed in .NET 11 RC2 by the separator-aware parsing backported in #56207. This PR does not change that behavior.This PR instead backports the later explicit-build-path validation relaxation from #56375. Without
--, Microsoft.Testing.Platform extension arguments are still forwarded as unmatched tokens. When an extension option value names an existing.csproj,.sln, or test module, RC2 can incorrectly treat that value as a non-first positional build path and emit a diagnostic asking the customer to use--project,--solution, or--test-moduleseven though one of those options is already present.The change suppresses that misleading diagnostic only when an explicit build-path option has already selected the build input. Positional inference and duplicate build-path validation remain unchanged.
.NET 10 already contains the same no-separator behavior through #56374, so this change aligns .NET 11 RC2 with the merged .NET 10 servicing fix and main.
Coverage includes the end-to-end
--projectscenario with and without--, plus direct parser coverage for--project,--solution, and--test-modulesin both forms.RC2 still hosts this logic in
MSBuildUtility.cs, so the mergedTestCommandOptions.csimplementation was adapted there without changing behavior.Related to #56338
Customer Impact
Customers using Microsoft.Testing.Platform extensions can pass existing project-, solution-, or module-like paths as extension option values consistently with or without
--when the build input is selected explicitly. The already-supported separator form is unchanged; this backport prevents valid no-separator invocations from failing with a misleading positional-path diagnostic.Regression?
Risk
The change is narrowly scoped to suppressing a diagnostic only when an explicit build path is already present. Existing positional inference and duplicate build-path validation remain unchanged, and the implementation matches the merged main fix and the behavior already present in .NET 10 servicing.
Verification
Manual
Automated
build.cmd -c Debugcompleted with 0 warnings and 0 errors.A focused
dotnet.Testsrun passed all 8 RC2 cases: two end-to-end--projectvariants and six direct parser variants for all three explicit build-path options with and without--.The
release/10.0.4xxbranch contains the!hasExplicitBuildPathOptionvalidation guard and regression coverage with[InlineData(false)]and[InlineData(true)]; all [release/10.0.4xx] Fix dotnet test argument isolation after -- #56374 PR checks passed.