From 6ac60355a2cc05e67c1828350b0082b4c32cd4a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 22:04:00 +0000 Subject: [PATCH 1/2] Initial plan From db5d361e2315dea493d2d41d24d634f452957e07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 22:07:47 +0000 Subject: [PATCH 2/2] Disable CooperativeBlockingCanCreateThreadsFaster on Debug runtime Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com> --- .../System.Threading.ThreadPool/tests/ThreadPoolTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs index d61ab0f8968c8c..6895adb2da1f89 100644 --- a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs +++ b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs @@ -913,7 +913,7 @@ public static void ThreadPoolThreadCreationDoesNotTransferExecutionContext() }).Dispose(); } - [ConditionalFact(typeof(ThreadPoolTests), nameof(IsThreadingAndRemoteExecutorSupported))] + [ConditionalFact(typeof(ThreadPoolTests), nameof(IsThreadingAndRemoteExecutorSupportedAndNotDebugRuntime))] public static void CooperativeBlockingCanCreateThreadsFaster() { // Run in a separate process to test in a clean thread pool environment such that work items queued by the test @@ -1501,6 +1501,10 @@ public static unsafe void ThreadPoolCompletedWorkItemCountTest() public static bool IsThreadingAndRemoteExecutorSupported => PlatformDetection.IsMultithreadingSupported && RemoteExecutor.IsSupported; + // Timing-sensitive tests can be too flaky on a Debug runtime, which is much slower + public static bool IsThreadingAndRemoteExecutorSupportedAndNotDebugRuntime => + IsThreadingAndRemoteExecutorSupported && !PlatformDetection.IsDebugRuntime; + private static bool GetUseWindowsThreadPool() { AppContext.TryGetSwitch("System.Threading.ThreadPool.UseWindowsThreadPool", out bool useWindowsThreadPool);