From a546eae3adc78fa8baf43e3bf9aec73c7a01c2fe Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Sat, 15 Aug 2026 16:20:41 +0200 Subject: [PATCH] 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 --- ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs b/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs index b3982c4a7..185c9bfed 100644 --- a/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs +++ b/ILSpy.Tests.Windows/Processes/NetFrameworkProcessesTests.cs @@ -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, });