Skip to content

[rel/4.5] Complete cleanup cancellation corrections - #12292

Merged
Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
evangelink-rel-4-5-cleanup-cancellation
Nov 9, 2026
Merged

Amaury Levé (Evangelink) merged 1 commit into
rel/4.5from
evangelink-rel-4-5-cleanup-cancellation

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Backport only the later cleanup review corrections from #12225. The original isolation fix #12220 is already in rel/4.5. This is an independent, squashable cleanup slice split from #12287, not a closing reference to that bundle.

Preserves release TestMethodInfo.Execution.cs layout and the non-null activation guard; separates cancellation from cleanup ownership, retains original deadlines and context-owned CTS lifetime, aggregates independent cleanup failures without losing timeout/inconclusive semantics, and recursively formats nested aggregate messages on .NET Framework. Exactly six source/test files; no fixture, Retry, IPC, F# feature, or MtpServerProcess slice. Public/shipped APIs and TFMs are unchanged; all six C# BOMs are preserved.

Revision identity

Revision Exact identity
Original bundle snapshot 826ef0f11a51e59861ceeb6e994917587add82d5
Cleanup source commit 601527fac8ea3e03811f0a433093b7a10099e3ce (parent 6be7eec3169d5324fdcf75c425b5e0e16a46fadf)
Standalone head 0a9a932a7af6780b749d4d040ea8f38336ef339b
Sole commit's parent / checked live release base a39964ce2cf09c4abcbaa7bb8f4e5818638a9de3
Standalone tree / required independent tree 32b68854ed6d552ebe4d71e1558c20a7643dca5c

Plain cherry-pick of the source commit; existing coauthor retained. The standalone tree equals the independently prepared six-file tree exactly.

Fresh standalone validation

All results below were executed against this standalone head, not borrowed from the original bundle's proof. Private checkout SDK 12.0.100-alpha.1.26480.103, outputs and NuGet caches; Windows/VS MSBuild.

Validation Result
Owning adapter unit graph, all five retained TFMs Passed; 0 warnings/errors
Owning framework unit graph, all four retained TFMs Passed; 0 warnings/errors
Full TestMethodInfoTests: net462, net48 134/134 each
Full TestMethodInfoTests: net8.0, net9.0, net8.0-windows10.0.18362.0 136/136 each
Full TestResultTests: net48, net8.0, net9.0, net8.0-windows10.0.18362.0 14/14 each
Focused unit total 732/732 passed; 0 skipped
Full standalone Release build/pack and package metadata/content verification Passed; 0 warnings/errors
CleanupCancellationIsolationTests, default source generation 13 discovered / 13 executed / 13 passed; 0 skipped
Same selector, MSTEST_ACCEPTANCE_SKIP_SOURCEGEN=1 10 discovered / 10 executed / 10 passed; 0 skipped
Same selector, MSTEST_ACCEPTANCE_SKIP_SOURCEGEN=true 10 discovered / 10 executed / 10 passed; 0 skipped

The opt-outs reduce the discovery plan; they are not skipped tests. Fresh outer TRX names, unique execution IDs, timestamps, counters and exit codes were checked against the exact plans. Packaged consumers checked loaded payload hashes, exact lifecycle traces, owned-resource removal, result names/outcomes, timeout details and both Framework failure identities (FailingCleanupTests.LocalCleanup and GlobalCleanupFixtures.GlobalCleanup). Independently retained 24/18/18 exact traces and 13/10/10 inner reports; no owned resources remained. [DoNotParallelize] remains on the shared generated-asset class; assembly-level method parallelization and the sequential internal TestContainer engine are unchanged.

The newly packed MSTest.TestAdapter.4.5.3-dev and MSTest.TestFramework.4.5.3-dev both identify the standalone commit in their nuspec repository metadata. Built, packed and loaded payload SHA-256 values matched:

Payload SHA-256
net8.0 MSTestAdapter.PlatformServices.dll FD7CCFB7ADA0B156C4BA9CB1C3B32C0F028488275CF662678F9DCEA8C62A8A04
net462 MSTest.TestFramework.dll 80C8D8BC0153AA59D198082A5E6A14DD97494258828B8340FC17B6D5C3EA9B22
Executed validation commands (only checkout/proof roots abbreviated)

$repo denotes this checkout and $proof its retained session evidence directory. Subsequent invocations used $repo\.dotnet with checkout-private .packages, artifacts\nuget-http-cache, artifacts\nuget-scratch and artifacts\dotnet-home; MSBUILDUSESERVER=0, DOTNET_CLI_UI_LANGUAGE=en-US.

.\build.cmd -c Release -msbuildEngine vs -projects test\UnitTests\MSTestAdapter.PlatformServices.UnitTests\MSTestAdapter.PlatformServices.UnitTests.csproj /p:EnableCodeCoverage=false "/bl:$repo\artifacts\log\Release\cleanup-adapter-units-8e72b9e773ff45b187dafa52317231ba.binlog"
.\build.cmd -c Release -msbuildEngine vs -projects test\UnitTests\TestFramework.UnitTests\TestFramework.UnitTests.csproj /p:EnableCodeCoverage=false "/bl:$repo\artifacts\log\Release\cleanup-framework-units-61ab8eec42d748f5b64159dba55ea582.binlog"
.\build.cmd -pack -c Release -msbuildEngine vs /p:EnableCodeCoverage=false "/bl:$repo\artifacts\log\Release\cleanup-standalone-pack-64ad1f7b523e41e9bae58783a3d381cd.binlog"

All three commands passed. Direct test-host commands were expanded over the target sets shown above:

# Adapter: $tfm = net462, net48
& "$repo\artifacts\bin\MSTestAdapter.PlatformServices.UnitTests\Release\$tfm\MSTestAdapter.PlatformServices.UnitTests.exe" --treenode-filter '/*/*/TestMethodInfoTests/*' --report-trx --report-trx-filename unit.trx --results-directory "$proof\unit-TestMethodInfoTests-$tfm" --show-test-results failed
# Adapter: $tfm = net8.0, net9.0, net8.0-windows10.0.18362.0
& "$repo\.dotnet\dotnet.exe" "$repo\artifacts\bin\MSTestAdapter.PlatformServices.UnitTests\Release\$tfm\MSTestAdapter.PlatformServices.UnitTests.dll" --treenode-filter '/*/*/TestMethodInfoTests/*' --report-trx --report-trx-filename unit.trx --results-directory "$proof\unit-TestMethodInfoTests-$tfm" --show-test-results failed
# Framework: net48
& "$repo\artifacts\bin\TestFramework.UnitTests\Release\net48\Microsoft.VisualStudio.TestPlatform.TestFramework.UnitTests.exe" --treenode-filter '/*/*/TestResultTests/*' --report-trx --report-trx-filename unit.trx --results-directory "$proof\unit-TestResultTests-net48" --show-test-results failed
# Framework: $tfm = net8.0, net9.0, net8.0-windows10.0.18362.0
& "$repo\.dotnet\dotnet.exe" "$repo\artifacts\bin\TestFramework.UnitTests\Release\$tfm\Microsoft.VisualStudio.TestPlatform.TestFramework.UnitTests.dll" --treenode-filter '/*/*/TestResultTests/*' --report-trx --report-trx-filename unit.trx --results-directory "$proof\unit-TestResultTests-$tfm" --show-test-results failed

All nine unit invocations passed with the exact class counts above. After pack, the following discovery/execution pair ran once with the opt-out unset ($mode=default), once set to 1, and once set to true; all passed:

& "$repo\.dotnet\dotnet.exe" "$repo\artifacts\bin\MSTest.Acceptance.IntegrationTests\Release\net11.0\MSTest.Acceptance.IntegrationTests.dll" --filter 'FullyQualifiedName~CleanupCancellationIsolationTests' --no-ansi --progress off --show-test-results failed --list-tests
& "$repo\.dotnet\dotnet.exe" "$repo\artifacts\bin\MSTest.Acceptance.IntegrationTests\Release\net11.0\MSTest.Acceptance.IntegrationTests.dll" --filter 'FullyQualifiedName~CleanupCancellationIsolationTests' --no-ansi --progress off --show-test-results failed --report-trx --report-trx-filename cleanup.trx --results-directory "$proof\consumer-$mode"

The net11.0 outer host requests the pinned .NET 12 runtime in its runtimeconfig; the generated consumers actually run net8.0 and net462. Fresh generated-asset builds produced seven binlogs, retained in per-plan directories before the next process could reuse their filenames.

Limitations: real AppX activation, hosted UI execution and current-head CI were not validated. No new counterfactual campaign was run on this head. TRX, source/payload provenance, exact traces and unique binlogs are retained as session evidence; generated consumer assets and per-run caches were removed, without clearing shared caches. This PR does not merge or modify #12287.

Apply the servicing follow-up from #12225 (upstream b3f3c98) on top of the original #12220 release isolation fix. Preserve release file layout and targets, cleanup ownership/deadlines, independent failures and Framework aggregate messages.

Retained tests execute against actual prior production: 12 of 136 lifecycle cases and 4 of 13 packed consumers fail for the intended missing corrections. Corrected code passes 732 focused unit executions, all 13 packaged consumers, and both 10-case source-generation opt-out plans.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Preliminary pipeline test triage (partial evidence, build still running)

Triggering check: microsoft.testfx (Build Linux Release) (build 1671217, analyzed at head 0a9a932).

Actionable failure: MSTest.Acceptance.IntegrationTests (net11.0), CleanupCancellationIsolationTests. 12 GlobalCleanup_* cases, e.g. GlobalCleanup_Normal, GlobalCleanup_LocalCooperativeTimeout and GlobalCleanup_TerminalCancellation_NonCooperativeTest, plus their _SourceGeneration variants, fail with the same assertion:

Assertion failed. Expected value to not be null.  actual: null  Assert.IsNotNull(adapterPayload)

In the JUnit report, GlobalCleanupAfterLocalCancellationReleasesOwnedResource failed on all 12 attempts with the same message. That points to a deterministic failure, not flakiness, and it sits in the area this PR changes (cleanup cancellation). The tests are likely not receiving the expected adapter payload. Please check the PR's changes against these tests.

Likely not related: the retry.trx, native_report.trx, filtered_report.trx and appcontainer-retry.trx failures look like deliberate probe or sample assets that fail by design. I saw no retry-flaky tests. The 614 skipped tests are mostly Windows-only or environment-gated.

History was incomplete, so I can't say whether these tests failed in earlier builds. No issue was created because this is a partial, pre-completion analysis. A final comment will follow when the full build completes.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · ~24 AIC · ⌖ ~1 AIC · ⊞ 10K

@Evangelink
Amaury Levé (Evangelink) merged commit 72475f8 into rel/4.5 Nov 9, 2026
19 of 22 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the evangelink-rel-4-5-cleanup-cancellation branch November 9, 2026 18:39
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.

1 participant