Include full command line in MTP validation errors#8255
Open
Copilot wants to merge 5 commits into
Open
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix MTP command-line validation error messages
Include full command line in MTP validation errors
May 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Augments MTP command-line validation errors to include the full original command line, making failures easier to diagnose when the invocation is hidden by surrounding test/CI infrastructure.
Changes:
CommandLineParseResultnow carries the original argv joined as aCommandLinestring, populated byParserfrom a snapshot taken before parsing mutates the argument list.CommandLineOptionsValidatorappends a localizedCommand line: {0}line (newCommandLineValidationCommandLineresource) to parser errors, unknown-option errors, arity errors, and option-argument validation errors.- Tests updated for the new error format and a new
--dotnet-test-pipearity-failure test exercises the tool-name + extra-argument case; resx + xlf resources updated across all locales.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/CommandLine/ParseResult.cs | Replaces primary constructor with explicit constructors; adds internal CommandLine property storing the joined original args. |
| src/Platform/Microsoft.Testing.Platform/CommandLine/Parser.cs | Snapshots args before parsing and forwards them to the new internal constructor. |
| src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs | Wraps invalid validation results with the new Command line: suffix via AddCommandLine/InvalidWithCommandLine helpers. |
| src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx | Adds CommandLineValidationCommandLine resource string. |
| src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.*.xlf | Generated new-state translation entries for the new resource across all locales. |
| test/UnitTests/Microsoft.Testing.Platform.UnitTests/CommandLine/CommandLineHandlerTests.cs | Updates expected error strings and adds tool-name + arity test. |
| test/UnitTests/Microsoft.Testing.Platform.UnitTests/CommandLine/ArgumentArityTests.cs | Updates expected error strings to include the appended command line. |
Copilot's findings
- Files reviewed: 19/19 changed files
- Comments generated: 0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink
reviewed
May 16, 2026
| const string wildcardMatchPattern = $""" | ||
| Microsoft.Testing.Platform v* | ||
| Unknown option '--{UnknownOption}' | ||
| Command line: * |
Member
There was a problem hiding this comment.
@copilot let's use real content and not wildcard here.
Contributor
Author
There was a problem hiding this comment.
Addressed in 1337c8a by asserting the exact command line instead of using a wildcard.
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
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.
Bug Fix
Invalid MTP command-line errors only reported the failing option, which is insufficient when the invoked command is hidden by test infrastructure or CI logs.
Command context
CommandLineParseResult.Validation coverage
--dotnet-test-pipearity failures with a test DLL/tool name.Example output: