Skip to content

Fix shutdown cancellation and process waits under parallel load - #431

Merged
Keboo merged 3 commits into
masterfrom
kepler/4103-parallel-ui-tests
Oct 20, 2026
Merged

Keboo merged 3 commits into
masterfrom
kepler/4103-parallel-ui-tests

Conversation

@Keboo

@Keboo Keboo commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix teardown failures observed when running ten non-interactive UI tests concurrently in MaterialDesignInXAML/MaterialDesignInXamlToolkit#4103. The failing run reported 17 gRPC Cancelled exceptions from App.DisposeAsync after test bodies and recorder success checks completed: https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/actions/runs/39060871422/job/117478381849.

  • Increase the shutdown RPC allowance from one second to ten seconds for both disposal paths.
  • Handle and log gRPC cancellation only when the local shutdown timeout has expired. Preserve unexpected RPC cancellations, other RPC failures, and server error replies.
  • Replace CPU-intensive process polling with bounded WaitForExit / WaitForExitAsync on the existing process instance. Retain forced termination and confirm exit with another bounded wait.
  • Preserve remote log cleanup even if process cleanup throws.
  • Test only public APIs: real hosts started with App.StartRemote, lifecycle behavior through IApp, and remote setup through RemoteExecute. No friend assemblies, internal casts, reflection into implementation details, or transport mocks.
  • Add Microsoft.CodeAnalysis.BannedApiAnalyzers to every project with a shared BannedSymbols.txt, banning InternalsVisibleToAttribute as an RS0030 build error.
  • Align MSTest adapter 4.4.1 with framework 4.5.1: the mismatch prevented discovery entirely.
  • Document disposal behavior and the public-API-only testing policy.

The server's existing 500 ms delayed shutdown/protocol is unchanged. Toolkit window activation and its package reference are also unchanged; consuming a published fixed build remains separate work.

Validation

  • dotnet build XAMLTest.slnx -c Release: succeeded with no warnings or errors.
  • dotnet test XAMLTest.Tests\XAMLTest.Tests.csproj -c Release --no-restore --filter FullyQualifiedName~AppDisposalTests --logger "console;verbosity=minimal": all 8 public-API cases passed.
  • Covers synchronous/asynchronous disposal of already-exited hosts, graceful slow exit, forced termination of a host blocked in its Exit event, nonblocking asynchronous disposal, and three batches of ten concurrent real hosts per disposal mode (60 hosts total).
  • Temporary negative build probes verified that both handwritten and SDK-generated InternalsVisibleTo attributes fail with RS0030. Probes were removed afterward.

The former implementation-level mocked RPC tests were removed rather than bypassing the public API boundary. The public lifecycle tests do not claim deterministic coverage of individual transport exception branches.

Keboo and others added 3 commits October 19, 2026 00:22
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Handle locally timed-out shutdown RPC cancellation without masking unexpected errors. Replace process polling with bounded synchronous and asynchronous exit waits, retaining forced termination and log cleanup. Add disposal regressions and repeated ten-host startup/shutdown coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove InternalsVisibleTo and implementation-level disposal mocks. Exercise real host lifecycle scenarios through IApp and RemoteExecute, restore test-local Win32 declarations, and enforce the repository-wide API ban with BannedApiAnalyzers and RS0030 errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Keboo
Keboo merged commit dd2dacd into master Oct 20, 2026
3 checks passed
@Keboo
Keboo deleted the kepler/4103-parallel-ui-tests branch October 20, 2026 03:42
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