Repository navigation
Explain non-success MTP exit codes in test summaries - #10882
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Review Summary
Verdict: ✅ All clear — no blocking or major issues found.
| # | Dimension | Verdict |
|---|---|---|
| 1 | Algorithmic Correctness | ✅ All ExitCode enum values (1–15, skipping reserved 6) are covered in the switch; _ => Unknown handles future/unrecognized codes. Guard exitCode is null or (int)ExitCode.Success correctly short-circuits. |
| 2 | Threading & Concurrency | N/A — new code is stateless (static methods, no shared mutable state). |
| 3 | Public API Surface | ✅ No new public API added. GetExitCodeDescription is internal static. |
| 4 | Backward Compatibility | ✅ Purely additive — new informational output appended after the existing summary line. No behavioral changes for success (exit code 0) or null. |
| 5 | Cross-TFM Correctness | ✅ Uses only Enum.GetValues(typeof(ExitCode)) (available on all TFMs). |
| 6 | IPC Contract Stability | N/A |
| 7 | Localization | ✅ All 15 exit-code descriptions + 2 format strings added to .resx; xlf files regenerated across all 13 locales. URL correctly locked in comments. |
| 8 | Performance | ✅ Negligible — a single switch on an int, executed once per test run completion. |
| 9 | Security | N/A |
| 10 | Error Handling | ✅ Unknown exit codes map to a generic "not recognized" description rather than throwing. |
| 11 | Resource Management | N/A |
| 12 | Test Quality | ✅ Two tests added: one validates a specific exit code renders the expected message; the other iterates every ExitCode enum value to ensure the switch is exhaustive — this will catch regressions if new exit codes are added without descriptions. |
| 13 | Code Style & Conventions | ✅ Consistent with codebase style. |
| 14 | Documentation | ✅ Output messages include `See: (aka.ms/redacted) link for discoverability. |
| 15 | MSBuild / Build | ✅ TerminalReporterContract.props updated to include ExitCodes.cs in the contract surface — correctly keeps the SDK terminal reporter in sync. |
| 16–22 | Remaining dimensions | N/A — no changes to nullable annotations, naming, init accessors, CLI options, analyzers, or PublicAPI.txt. |
Clean, well-scoped PR. The exhaustive-enum test (GetExitCodeDescription_MapsEveryKnownFailureExitCode) is a nice guard against future regressions when new exit codes are added.
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Lifecycle.cs — This new internal member is missing from InternalAPI/InternalAPI.Unshipped.txt, so the platform's… |
|
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs — The new test covers only the run-summary resource, but the implementation also adds a separate… |
|
test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… |
|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… |
What changed in this PR
Improves MTP terminal summaries by explaining non-success exit codes, including the reporter contract vendored by dotnet/sdk.
Changes:
- Maps known exit codes to localized descriptions with an unknown-code fallback.
- Adds descriptions to run and discovery summaries.
- Updates contract dependencies, localization inputs, and tests.
| File | Description |
|---|---|
TerminalTestReporterTests.cs |
Tests exit-code rendering and mappings. |
TerminalReporterContractTests.cs |
Validates the shared resource contract. |
TerminalTestReporter.Lifecycle.cs |
Appends descriptive exit-code messages. |
TerminalResources.resx |
Defines exit-code messages and descriptions. |
TerminalResources.cs |
Adds strongly typed resource accessors. |
TerminalReporterContract.props |
Adds the shared ExitCode dependency. |
TerminalResources.cs.xlf |
Updates Czech localization inputs. |
TerminalResources.de.xlf |
Updates German localization inputs. |
TerminalResources.es.xlf |
Updates Spanish localization inputs. |
TerminalResources.fr.xlf |
Updates French localization inputs. |
TerminalResources.it.xlf |
Updates Italian localization inputs. |
TerminalResources.ja.xlf |
Updates Japanese localization inputs. |
TerminalResources.ko.xlf |
Updates Korean localization inputs. |
TerminalResources.pl.xlf |
Updates Polish localization inputs. |
TerminalResources.pt-BR.xlf |
Updates Brazilian Portuguese localization inputs. |
TerminalResources.ru.xlf |
Updates Russian localization inputs. |
TerminalResources.tr.xlf |
Updates Turkish localization inputs. |
TerminalResources.zh-Hans.xlf |
Updates Simplified Chinese localization inputs. |
TerminalResources.zh-Hant.xlf |
Updates Traditional Chinese localization inputs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
Pre-existing issues (4)
| Severity | Finding |
|---|---|
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs — The new test covers only the run-summary resource, but the implementation also adds a separate… View comment |
|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Lifecycle.cs — This new internal member is missing from InternalAPI/InternalAPI.Unshipped.txt, so the platform's… View comment |
|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… View comment |
|
test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… View comment |
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs:3239
- This assertion does not verify that each exit code maps to its correct description; mapping every code to any non-unknown resource (or swapping two descriptions) still passes. Since this test is intended to cover every known mapping, assert the exact resource expected for each enum value.
Assert.AreNotEqual(
TerminalResources.ExitCodeUnknownDescription,
TerminalTestReporter.GetExitCodeDescription((int)exitCode),
$"Exit code '{exitCode}' should have a description.");
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Lifecycle.cs:204
- This new internal member is part of the API-tracked
Microsoft.Testing.Platformassembly, but it is absent fromInternalAPI/InternalAPI.Unshipped.txt. ExistingTerminalTestReporterinternal members are tracked inInternalAPI.Shipped.txt:1744-1772, so RS0016 will fail the build. Add the generated signature forGetExitCodeDescriptionto the unshipped baseline (or make it private and update its tests).
internal static string GetExitCodeDescription(int exitCode)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: None
Issues resolved since last review (4)
| Severity | Finding |
|---|---|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… View resolved comment |
|
test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs — This changed C# file is currently UTF-8 without a BOM, contrary to .editorconfig:66-67 (`charset… View resolved comment |
|
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs — The new test covers only the run-summary resource, but the implementation also adds a separate… View resolved comment |
|
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Lifecycle.cs — This new internal member is missing from InternalAPI/InternalAPI.Unshipped.txt, so the platform's… View resolved comment |
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs:3260
- This assertion only proves that each enum value avoids the fallback; swapped or otherwise incorrect descriptions would all pass. Assert the exact resource expected for every exit code, while retaining a count check so adding a future enum member also requires a mapping test.
Assert.AreNotEqual(
TerminalResources.ExitCodeUnknownDescription,
TerminalTestReporter.GetExitCodeDescription((int)exitCode),
$"Exit code '{exitCode}' should have a description.");
🧵 Parallel-safety audit — PR #10882Nothing audited here touches process-global state, shared filesystem paths, or The PR adds/modifies three tests around MTP's
No changed Audited Re-run with
|


The
dotnet testsummary currently reports only a numeric MTP exit code and a documentation link, which makes common failures such as invalid command-line arguments unnecessarily opaque.Changes
For example, exit code 5 is now reported as:
Validation
Microsoft.Testing.Platform.UnitTestsfor all target frameworks.Microsoft.Testing.Platform.TerminalReporterContract.UnitTests.TerminalTestReporterTestsplus focused exit-code mapping tests.Microsoft.Testing.Platform.Acceptance.IntegrationTestsin Release and passed both external-process exit-code summary scenarios.Downstream consideration
dotnet/sdkvendors this terminal reporter from testfx, so the SDK copy must be synchronized before the improved message appears indotnet test.