From 65df0aa13e27587fbf0b068fa6764cff192eb805 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Wed, 4 Nov 2026 17:05:57 +0000 Subject: [PATCH] Cut STAThreadTests repeats so the Windows reflection pass run fits its timeout The Windows [EngineTest=Pass] reflection run was not hung: in both captured dumps the process's CPU time tracked its progress, and the newest capture was in the final NotInParallel phase. The run is CPU bound, and STAThreadTests with [Repeat(100)] used about 120 of its 140 CPU seconds, because each test and each of the ~55 global per-test hooks runs on a new STA thread. On the 4-core Windows runner that pushed the run past its 10-minute timeout. Repeat(10) keeps every STA scenario and cuts the run on 4 local cores from 139 s CPU / 2m33s to 30 s CPU / 1m48s. Fixes #7554 --- tests/TUnit.TestProject/STAThreadTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/TUnit.TestProject/STAThreadTests.cs b/tests/TUnit.TestProject/STAThreadTests.cs index 7619eb54390..cc904f10269 100644 --- a/tests/TUnit.TestProject/STAThreadTests.cs +++ b/tests/TUnit.TestProject/STAThreadTests.cs @@ -7,7 +7,12 @@ namespace TUnit.TestProject; [EngineTest(ExpectedResult.Pass)] [RunOn(OS.Windows)] -[Repeat(100)] +// Keep the repeat count low. STAThreadExecutor runs the test and every global [BeforeEvery(Test)] and +// [AfterEvery(Test)] hook in this project (about 55 of them) on its own new STA thread, and each +// one costs about 1ms of CPU, mostly in the kernel. With [Repeat(100)] this class started about +// 78,000 threads and used about 120 of the 140 CPU seconds that the [EngineTest=Pass] run needs. +// On the 4-core Windows CI runner that pushed the run past its 10-minute timeout (#7554). +[Repeat(10)] [UnconditionalSuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] public class STAThreadTests {