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);