Browse Source

Tie the .NET Framework fixture host to the test host's lifetime

The PowerShell host used to sleep for a fixed 300 s, so any run in which
the process walks got slow (as happened on a starved CI runner) lost the
host mid-fixture and failed the remaining tests for the wrong reason.
Waiting on the test host's PID makes the fixture independent of wall
clock and also guarantees the host disappears with the test host even
if the teardown never runs.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/4036/head
Christoph Wille 1 month ago
parent
commit
a546eae3ad
  1. 4
      ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs

4
ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs

@ -55,8 +55,10 @@ public class NetFrameworkProcessesTests @@ -55,8 +55,10 @@ public class NetFrameworkProcessesTests
File.Exists(WindowsPowerShellPath).Should().BeTrue(
"Windows PowerShell 5.1 is the .NET Framework process this fixture inspects");
// The host lives exactly as long as the test host process: no wall clock for a slow
// machine to outrun mid-fixture, and no orphan if the teardown never runs.
host = Process.Start(new ProcessStartInfo(WindowsPowerShellPath,
"-NoProfile -NonInteractive -Command \"Start-Sleep -Seconds 300\"") {
$"-NoProfile -NonInteractive -Command \"Wait-Process -Id {Environment.ProcessId}\"") {
UseShellExecute = false,
CreateNoWindow = true,
});

Loading…
Cancel
Save