Steps to reproduce
The unit test TestAppDomainProcessExitEvenHandlerNotLeaking is flaky.
Currently is the top 1 faling test in the last 30 days. Failed 20 times out of 87 runs (23% failure rate).
And all failures have the same error message and stack trace.
Seems to have been introduced 10/10 in Add test for the even handler leaking fix #10768 .
Error Message
Assert.DoesNotContain() Failure
Found: (filter expression)
In value: Delegate[] [EventHandler { Method = Void DisposeOnShutdown(System.Object, System.EventArgs), Target = null }, EventHandler { Method = Void CurrentDomain_ProcessExit(System.Object, System.EventArgs), Target = null }]
Stack Trace
at PSTests.Sequential.RunspaceTests.TestAppDomainProcessExitEvenHandlerNotLeaking() in D:\a\1\s\test\xUnit\csharp\test_Runspace.cs:line 127
PowerShell-CI-windows - Test failure report
Expected behavior
Test results should be consistent.
Actual behavior
Test is flaky.
Environment data
Unit tests must be executed in a windows platform.
Steps to reproduce
TestAppDomainProcessExitEvenHandlerNotLeakingis flaky.Error Message
Stack Trace
PowerShell-CI-windows - Test failure report

Expected behavior
Test results should be consistent.
Actual behavior
Test is flaky.
Environment data
Unit tests must be executed in a windows platform.