Skip to content

Backport MTP handshake failure diagnostics - #55377

Merged
Evangelink merged 4 commits into
dotnet:release/10.0.1xxfrom
Evangelink:dev/amauryleve/backport-mtp-handshake-diagnostics
Sep 15, 2026
Merged

Evangelink merged 4 commits into
dotnet:release/10.0.1xxfrom
Evangelink:dev/amauryleve/backport-mtp-handshake-diagnostics

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Backports the minimal Microsoft.Testing.Platform handshake diagnostics from #54501 to release/10.0.1xx.

When an unmatched option is forwarded to an MTP test application and the application exits before the handshake (for example with InvalidCommandLine / exit code 5), dotnet test now:

  • surfaces the already-captured child stdout and stderr
  • reports the overall summary as Failed! instead of Zero tests ran
  • reprints actionable handshake failures after the summary so they remain visible at the end of verbose runs

This is the diagnostic companion/backport for #55309. It is intentionally distinct from #55376, which maps --nologo to MTP's --no-banner on main.

The new recap heading is localized through the normal generated XLF workflow.

Validation

  • GivenDotnetTestRunsConsoleAppWithoutHandshake: 3 passed
  • focused unsupported-option regression verifies stdout, stderr, exit code 5, failed summary, and end-of-run recap

Surface captured test host output when an MTP application exits before handshake, mark the run failed, and recap actionable failures after the summary. Add regression coverage for an unsupported forwarded option.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: fca5f32b-6c6e-4767-a336-248686d7d8ad
Copilot AI review requested due to automatic review settings July 20, 2026 13:21
@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.

Pull request overview

Backports improved Microsoft.Testing.Platform (MTP) handshake-failure diagnostics into release/10.0.1xx so dotnet test surfaces pre-handshake failures more clearly (captured stdout/stderr, correct “Failed!” headline, and an end-of-run recap).

Changes:

  • Track handshake-failure details during the run and re-print a “Handshake failures:” recap after the test-run summary.
  • Adjust summary headline selection so handshake failures produce Failed! instead of a misleading Zero tests ran.
  • Add/extend regression coverage for invalid-option pre-handshake failures and localize the recap header.
Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestRunsConsoleAppWithoutHandshake.cs Adds regression asserting stdout/stderr surfacing, failed summary headline, and end-of-run recap for pre-handshake failures.
src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporter.cs Tracks handshake failures and appends a recap after the run summary; updates summary precedence.
src/Cli/dotnet/Commands/CliCommandStrings.resx Adds localized resource string for the “Handshake failures:” recap header.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf Adds new trans-unit for the recap header localization.
src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf Adds new trans-unit for the recap header localization.

Copilot's findings

  • Files reviewed: 16/16 changed files
  • Comments generated: 3

Use localized resources in the regression assertions, normalize control characters in captured host output, and correct the generated localization note.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: fca5f32b-6c6e-4767-a336-248686d7d8ad
@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 14, 2026 10:25
@rbhanda rbhanda added this to the 10.0.13 milestone Sep 14, 2026
Use ConcurrentQueue to retain handshake failures without a separate lock and counter.

Co-authored-by: Copilot App <[email protected]>
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Build Failure Analysis

Summary — The build itself did not fail due to a code problem in this PR: 21 of 24 build legs (all TestBuild, TestAsTools, FullFramework compile phases, and the 4_1/8_x AoT legs) compiled cleanly with zero MSBuild errors. Only one leg (4_0_AoT_macOS_x64) shows a genuine build-time error, and it is a transient network/infrastructure failure, not a source-code defect. Two other legs (10_1_FullFramework_windows_x64, 9_0_TestBuild_linux_x64) failed later in a Helix test-execution step, which is outside the scope of this build-failure analysis.

Root cause 1: Network flake downloading bundled components (4_0_AoT_macOS_x64)

The redist.csproj → DownloadBundledComponents target (in RestoreLayout.targets) failed with an HttpRequestException / HttpIOException: The response ended prematurely (ResponseEnded) while calling Microsoft.DotNet.Arcade.Sdk.DownloadFile.DownloadWithRetriesAsync. This is a mid-download connection drop against whatever host is serving the bundled-component payload — not something a source change in this PR can cause or fix. Only this one leg (out of the three AoT_macOS_x64 attempts, 4_0/4_1/4_2) shows the error; the sibling AoT legs (4_1, and the 8_x Windows AoT legs) completed with 0 errors, which is consistent with a one-off connectivity blip rather than a systemic or code-caused issue.

Affected files / errors

  • src/Layout/redist/targets/RestoreLayout.targets:314 — DownloadFile task, target DownloadBundledComponents, project src/Layout/redist/redist.csproj: HttpRequestException: Error while copying content to a stream. → HttpIOException: The response ended prematurely. (ResponseEnded)

Recommendation

This looks like a build-agent/network flake, not a code defect. Recommend re-running the failed 4_0_AoT_macOS_x64 leg (or the whole pipeline) rather than making a source change. No suggestion is proposed since there is no code-level root cause here.

Out of scope: Helix test failures (10_1_FullFramework_windows_x64, 9_0_TestBuild_linux_x64)

Both legs compiled with 0 MSBuild errors; the reported error is a CheckHelixJobStatus task failure: Work item dotnet-watch.Tests.dll.1 ... has failed (Helix job console logs linked in the raw error). This is a test-execution failure on Helix, not a build failure, so it is out of scope for this build-failure analysis. If needed, inspect the linked Helix console logs directly.


Build overview (4_0_AoT_macOS_x64)
Build: FAILED
Duration: 1067.1s
MSBuild: 18.0.11+e2f47b011
Projects: 174  Errors: 2  Warnings: 0

Failed projects:
  ✗ Build.proj (1066.7s)
  ✗ sdk.slnx (905.3s)
  ✗ redist.csproj (680.1s)
  ✗ dotnet-sdk.proj (680.6s)
All legs checked (24 total)
Leg Result
10_0, 10_2_FullFramework_windows_x64 ✅ 0 errors
10_1_FullFramework_windows_x64 ⚠️ Helix test failure (dotnet-watch.Tests.dll.1) — out of scope
2_0, 2_1_TestBuild_linux_arm64 ✅ 0 errors
3_0, 3_1_TestAsTools_windows_x64 ✅ 0 errors
4_0_AoT_macOS_x64 ❌ Network flake (DownloadBundledComponents)
4_1_AoT_macOS_x64 ✅ 0 errors
5_0–5_2_TestBuild_macOS_arm64 ✅ 0 errors
6_0–6_2_TestBuild_windows_x64 ✅ 0 errors
7_0–7_2_TestBuild_macOS_x64 ✅ 0 errors
8_0–8_2_AoT_windows_x64 ✅ 0 errors
9_0_TestBuild_linux_x64 ⚠️ Helix test failure (dotnet-watch.Tests.dll.1) — out of scope
9_1, 9_2_TestBuild_linux_x64 ✅ 0 errors

🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit 11a1073

🤖 Automated content by GitHub Copilot. Generated by the Build Failure Analysis workflow. · auto · 107.7 AIC · ⌖ 1.97 AIC · ⊞ 7.2K · [◷]( · ◷)

@Evangelink
Evangelink merged commit 8fcdf05 into dotnet:release/10.0.1xx Sep 15, 2026
27 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/backport-mtp-handshake-diagnostics branch October 7, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants