Skip to content

[rel/4.5] Restore MTP startup diagnostics under dotnet test - #12027

Merged
Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
dev/amauryleve/4-5-startup-diagnostics
Oct 20, 2026
Merged

Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
dev/amauryleve/4-5-startup-diagnostics

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Independent rel/4.5 backport of #11971, restoring MTP startup diagnostics under native dotnet test for #11964.

Source commit: a93dbf24f42227f60bb2b32a4468d3643b20fffe.
Release base: 133c4720c6671061d6a315a517e98578838eda3c.
Backport commit: 3ae75236b4e61a7ec1c52fc9409b5f3028cfa350.

All five changed files exactly match the merged source PR. This branch contains one backport commit, no other fixes, and no SDK/version changes.

Warnings/errors fall back to the existing console service only before a dotnet-test connection is registered. Validation still exits 5 without opening the pipe. Informational/help output remains suppressed; connected forwarding and legacy-protocol suppression are unchanged.

Validation and regression evidence

Windows, Release; repository SDK 12.0.100-alpha.1.26480.103, unchanged from the release branch. The complete changed MTP package was packed for net8.0, net9.0, and netstandard2.0. Unit tests ran on .NET 8.0.31. The acceptance host targets net11.0 and ran on the SDK's .NET 12 runtime with DOTNET_ROLL_FORWARD=Major; its generated consumers target net10.0.

The unfixed comparison retained the final tests and packed the original release production code. It did not rely on setup failures, skips, or zero executed tests.

Executed coverage Unfixed release Backport
DotnetTestPassthroughOutputDeviceTests Exit 2: 8 executed, 6 passed, 2 intended missing-console-write failures Exit 0: 8 passed
Four DotnetTestPipeStartupErrorTests data rows: unknown option, missing extension, duplicate providers, malformed configuration All four failed at the missing diagnostic assertion; child exit 5 was preserved All four passed
Protocol 1.3 forwarding, protocol 1.2 suppression, quiet passing-host guards All three passed All three passed
Combined focused acceptance selection Exit 2: 7 executed, 3 passed, 4 intended failures Exit 0: 7 passed

There were no skipped cases. TRX, JUnit, and CTRF reports were parsed and their counts reconciled. The built/tested five-file source state was verified unchanged when committed.

Recorded repository commands

Commands ran from the worktree root in a child process with repo-local DOTNET_ROOT, MSBuild server reuse disabled, an explicit shortened Windows PATH, and DOTNET_PROCESSOR_COUNT=2. Build/pack commands additionally used /m:2 or -m:2; native dotnet test used --max-parallel-test-modules 1.

$repo = (Get-Location).Path
$dotnet = "$repo\.dotnet\dotnet.exe"
$unit = 'test\UnitTests\Microsoft.Testing.Platform.UnitTests\Microsoft.Testing.Platform.UnitTests.csproj'
$acceptance = 'test\IntegrationTests\Microsoft.Testing.Platform.Acceptance.IntegrationTests\Microsoft.Testing.Platform.Acceptance.IntegrationTests.csproj'
$filter = 'FullyQualifiedName~DotnetTestPipeStartupErrorTests|FullyQualifiedName~DotnetTestPipeDisplayMessageForwardingTests|FullyQualifiedName~DotnetTestPipe_ChildEmitsNoStdoutOrStderrForPassingRun_Baseline'

# Unfixed production + retained tests; exit 0, complete three-TFM MTP package.
& 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\eng\build.ps1 -restore -build -pack -configuration Release -projects src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj -msbuildEngine dotnet -binaryLog /m:2 /nr:false

# Exit 2: 6 passed, 2 intended failures.
& $dotnet test --project $unit -c Release -f net8.0 --filter FullyQualifiedName~DotnetTestPassthroughOutputDeviceTests -p:UsingDotNetTest=true -p:EnableCodeCoverage=false "-p:ArtifactsTestResultsDir=$repo\artifacts\TestResults\startup-baseline-unit" '-bl:artifacts\startup-validation\baseline-unit.binlog' --show-test-results all --max-parallel-test-modules 1

# Exit 0: acceptance host build, zero warnings/errors.
& $dotnet build $acceptance -c Release -m:2 -nr:false -p:EnableCodeCoverage=false -p:UsingDotNetTest=true '-bl:artifacts\startup-validation\baseline-acceptance-build.binlog' -v minimal

# DOTNET_ROLL_FORWARD=Major; isolated acceptance-baseline-cache; exit 2: 3 passed, 4 intended failures.
& $dotnet test --project $acceptance --no-build -c Release --filter $filter -p:UsingDotNetTest=true -p:EnableCodeCoverage=false -p:TestRunnerAdditionalArguments= "-p:ArtifactsTestResultsDir=$repo\artifacts\TestResults\startup-baseline-acceptance" '-bl:artifacts\startup-validation\baseline-acceptance.binlog' --show-test-results all --max-parallel-test-modules 1

# Fixed production; exit 0, complete three-TFM MTP package.
& $dotnet pack src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj -c Release --no-restore -m:2 -nr:false '-bl:artifacts\startup-validation\fixed-core-pack.binlog' -v minimal

# Exit 0: 8 passed.
& $dotnet test --project $unit --no-restore -c Release -f net8.0 --filter FullyQualifiedName~DotnetTestPassthroughOutputDeviceTests -p:UsingDotNetTest=true -p:EnableCodeCoverage=false "-p:ArtifactsTestResultsDir=$repo\artifacts\TestResults\startup-fixed-unit" '-bl:artifacts\startup-validation\fixed-unit.binlog' --show-test-results all --max-parallel-test-modules 1

# Exit 0: acceptance host rebuild, zero warnings/errors.
& $dotnet build $acceptance --no-restore -c Release -m:2 -nr:false -p:EnableCodeCoverage=false -p:UsingDotNetTest=true '-bl:artifacts\startup-validation\fixed-acceptance-build.binlog' -v minimal

# DOTNET_ROLL_FORWARD=Major; isolated acceptance-fixed-cache; exit 0: 7 passed.
& $dotnet test --project $acceptance --no-build -c Release --filter $filter -p:UsingDotNetTest=true -p:EnableCodeCoverage=false -p:TestRunnerAdditionalArguments= "-p:ArtifactsTestResultsDir=$repo\artifacts\TestResults\startup-fixed-acceptance" '-bl:artifacts\startup-validation\fixed-acceptance.binlog' --show-test-results all --max-parallel-test-modules 1

The acceptance-harness prerequisite packages were individually packed from this release checkout with dotnet pack <project> -c Release -m:2 -nr:false -p:SkipUapTargetFramework=true -bl:<unique-log> -v minimal. The changed MTP package did not exclude any of its shipping TFMs. This is targeted packaging, not a claimed full-solution/UAP pack.

Real shipping-SDK composed-product check

Separately built package-consuming net10.0 applications with shipping SDK 10.0.402, explicitly referencing the locally packed MTP, Platform.MSBuild, and TrxReport 2.5.2-dev packages. Baseline/fixed consumers used separate NuGet caches, pinned SDK selection, and source mapping that forces Microsoft.Testing.* to the local release feed.

Both states passed all nine expected contract scenarios:

Native SDK / host command Parent exit, before and after Observable evidence
dotnet test --project Good\Good.csproj --no-build -c Release --report-trx --results-directory <normal> 0 Exactly one ReleaseConsumerTest passed in the TRX; plain informational sentinel absent
Same Good project with --unknown-option, --report-gh, or --config-file <invalid.json>; Bad project registers duplicate my-option providers 5, each Before: diagnostic absent. After: exact corresponding diagnostic visible; informational help still absent
dotnet test --solution Consumer.slnx --no-build -c Release --report-trx --results-directory <mixed> 5 Valid module still passed one test and produced exactly one passing-test TRX; invalid-module diagnostic restored
Good project with STARTUP_CONSUMER_MODE=failed 2 Exactly one intentionally failed test in the TRX; expected product failure, not a backport validation failure
Good project with STARTUP_CONSUMER_MODE=zero 8 Zero-result exit unchanged
Direct host with --server dotnettestcli --dotnet-test-pipe <live-listener> --unknown-option 5 Listener never connected; diagnostic restored without moving the handshake

The SDK invocations above also captured unique binlogs. The direct-host invocation does not invoke MSBuild. Both consumer solutions were built with dotnet build Consumer.slnx -c Release -m:2 -nr:false -bl:<unique-log> -v minimal (exit 0).

Readable diagnostic transcript, abbreviating SDK summary/path lines:

Before:
  Zero tests ran
  Exit code: 5
  [no provider diagnostic]

After:
  Zero tests ran
  Exit code: 5
    Standard output: Option '--my-option' is declared by multiple providers: 'ProviderA', 'ProviderB'

The isolated SDK cache's nupkg matched the packed nupkg byte-for-byte. Both executed SDK consumer DLLs matched the package's net9.0 payload; all eight retained acceptance output DLLs per comparison state matched the corresponding payload too.

MTP 2.5.2-dev package SHA-256
Unfixed release 162359B0C577566D1D4F837BE53E628F22E22E648A390E2243190ACCB3070BDF
Backport 2D87F9166DB4E3EE80CB2E0EDB07C699080A81E865DBCA1A73DB75F42C9EB9D8

Evidence is retained locally under artifacts\TestResults\startup-{baseline,fixed}-{unit,acceptance}, artifacts\startup-validation, and this Copilot session's files (recorded argument lists, harness source, logs, summaries). These are local artifacts, not links to published CI artifacts.

Limitations: focused Windows validation only; no full solution, classic UAP, Linux/macOS, or separate cancellation-suite execution. The branch's SDK pin and cancellation/protocol implementations were not changed. No remaining blocker for the focused backport validation; remote CI is not claimed green.

Backport #11971 independently onto rel/4.5, retaining its warning/error
console fallback before the pipe connection and its unit and packed-consumer
regression coverage.

(cherry picked from commit a93dbf2)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b024fc53-2e58-4ac1-99c0-aa0d7fd2d8c6
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Oct 19, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 19, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1640957

Analysis is final (completed/aggregate build; evidence is not incomplete).

The build completed with overall result succeeded. Across 108,826 normalized test records (CTRF/TRX/JUnit) only 6 failed, all within the Windows_App_Model_Diagnostics build leg, and all 6 are attempt-1 failures that passed on the subsequent retry attempt within the same build run:

Test Attempt 1 Attempt 2 Message
WinUIMtpPackagedApp.UnitTest1.RetryFailsFirstAttempt failed passed "This probe deliberately fails the first retry attempt and passes the next one."
PackagedWinUI.PackagedWinUITestCases.RetryTestMethod_PassesOnSecondAppContainerHost failed passed "The first AppContainer host fails so Retry must activate a second host."
NativeTests.Outcome (×4 occurrences, different temp dirs) failed passed "expected host failure"

These are not product or regression defects: the test names and assertion messages make clear they are intentional retry-recovery probes that exercise the MTP retry/AppContainer-host-failover extension points added/touched by this PR (startup diagnostics under dotnet test). Each probe is designed to fail its first attempt and succeed on retry, and every occurrence in this build did exactly that — a proven fail-then-pass recovery is the expected, by-design behavior here rather than flakiness.

No other failures, crashes, hangs, or duration regressions were found (diagnosticCount: 0, timelineSignalCount: 0, slowRegressionCount: 0). History shows no cross-build recurrence signal to analyze for this PR context.

I searched open/closed issues for these test names and found none.

Conclusion: No actionable defect. No issue created — this is expected retry-probe behavior for build 1640957, not a flaky or broken test. No further action needed.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · 59 AIC · ⌖ 4.42 AIC · ⊞ 9.7K

@Evangelink
Amaury Levé (Evangelink) merged commit 5f08405 into rel/4.5 Oct 20, 2026
31 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/4-5-startup-diagnostics branch October 20, 2026 11:43
@github-actions github-actions Bot removed the state/approved Proposal approved; ready for implementation. label Oct 20, 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.

2 participants