Describe the bug
Microsoft.Testing.Extensions.TrxReport 2.4.0 makes controller-backed TRX generation active on supported desktop operating systems even when --crashdump is not used. On the first graceful external cancellation, the controller terminates the child test host before its in-process cancellation path and cleanup hooks can complete.
This regresses working behavior with TrxReport 2.3.3.
Version used
Microsoft.Testing.Extensions.TrxReport 2.4.0
Microsoft.Testing.Platform 2.4.0
- .NET 10
- Reproduced on GitHub-hosted Ubuntu x64 and macOS arm64 runners
Steps To Reproduce
TUnit has four existing integration tests covering test-, class-, assembly-, and session-level cleanup after graceful external cancellation:
https://github.com/thomhurst/TUnit/blob/c50a120a73546c4ca50a519f94193998bec35e28/tests/TUnit.Engine.Tests/ExternalCancellationTests.cs#L22
- Run a test application with
--report-trx and a long-running test.
- Send graceful cancellation/SIGINT to the test application.
- Let the test framework handle cancellation and run its cleanup hooks.
- Observe that all four marker files written by TUnit cleanup hooks are missing.
Failing CI evidence:
Each test reports successful process cancellation, then fails because its expected cleanup marker does not exist. Reverting only TrxReport from 2.4.0 to 2.3.3 restores previous behavior.
Expected behavior
First/graceful cancellation should allow the child test host and test framework to process cancellation and finish registered cleanup/lifetime hooks. Forceful cancellation may terminate it.
Actual behavior
The controller kills the test host immediately when applicationCancellationToken is canceled, so in-process cleanup cannot complete.
The relevant behavior changed between these versions:
Controller-side lifetime handlers run after process exit, but they cannot recover in-process test-framework cleanup hooks after the child has been killed.
Additional context
TUnit temporarily excludes TrxReport 2.4.0 while retaining the other MTP 2.4.0 packages:
thomhurst/TUnit#6717
Describe the bug
Microsoft.Testing.Extensions.TrxReport2.4.0 makes controller-backed TRX generation active on supported desktop operating systems even when--crashdumpis not used. On the first graceful external cancellation, the controller terminates the child test host before its in-process cancellation path and cleanup hooks can complete.This regresses working behavior with TrxReport 2.3.3.
Version used
Microsoft.Testing.Extensions.TrxReport2.4.0Microsoft.Testing.Platform2.4.0Steps To Reproduce
TUnit has four existing integration tests covering test-, class-, assembly-, and session-level cleanup after graceful external cancellation:
https://github.com/thomhurst/TUnit/blob/c50a120a73546c4ca50a519f94193998bec35e28/tests/TUnit.Engine.Tests/ExternalCancellationTests.cs#L22
--report-trxand a long-running test.Failing CI evidence:
Each test reports successful process cancellation, then fails because its expected cleanup marker does not exist. Reverting only TrxReport from 2.4.0 to 2.3.3 restores previous behavior.
Expected behavior
First/graceful cancellation should allow the child test host and test framework to process cancellation and finish registered cleanup/lifetime hooks. Forceful cancellation may terminate it.
Actual behavior
The controller kills the test host immediately when
applicationCancellationTokenis canceled, so in-process cleanup cannot complete.The relevant behavior changed between these versions:
--crashdumpis set:https://github.com/microsoft/testfx/blob/v4.3.3/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxModeHelpers.cs#L15-L17
https://github.com/microsoft/testfx/blob/v4.4.0/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxModeHelpers.cs#L33-L50
WaitForExitAsync, then the controller callstestHostProcess.Kill():https://github.com/microsoft/testfx/blob/v4.4.0/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostControllersTestHost.ProcessLifecycle.cs#L127-L137
Controller-side lifetime handlers run after process exit, but they cannot recover in-process test-framework cleanup hooks after the child has been killed.
Additional context
TUnit temporarily excludes TrxReport 2.4.0 while retaining the other MTP 2.4.0 packages:
thomhurst/TUnit#6717