From bea614698c1e3e4c1311349f0917ab75b1e88c1e Mon Sep 17 00:00:00 2001 From: Jason Naylor Date: Fri, 29 May 2026 09:41:36 -0700 Subject: [PATCH] Fix intermittent access violation in RenderBenchmark tests Add [Apartment(ApartmentState.STA)] to RenderTimingSuiteTests and RenderVerifyTests. The Views COM objects (VwGraphicsWin32Class, _VwRootBoxClass) require STA threading; without the attribute, NUnit runs these tests on an MTA thread, causing intermittent access violations during RootBox.Layout in CI. Co-Authored-By: Claude Opus 4.6 --- Src/Common/RootSite/RootSiteTests/RenderTimingSuiteTests.cs | 2 ++ Src/Common/RootSite/RootSiteTests/RenderVerifyTests.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Src/Common/RootSite/RootSiteTests/RenderTimingSuiteTests.cs b/Src/Common/RootSite/RootSiteTests/RenderTimingSuiteTests.cs index ef07c20da5..60900efc95 100644 --- a/Src/Common/RootSite/RootSiteTests/RenderTimingSuiteTests.cs +++ b/Src/Common/RootSite/RootSiteTests/RenderTimingSuiteTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Threading; using NUnit.Framework; using SIL.FieldWorks.Common.RootSites.RenderBenchmark; using SIL.FieldWorks.Common.RenderVerification; @@ -15,6 +16,7 @@ namespace SIL.FieldWorks.Common.RootSites [TestFixture] [Category("RenderBenchmark")] [Category("Performance")] + [Apartment(ApartmentState.STA)] public class RenderTimingSuiteTests : RenderBenchmarkTestsBase { private static List m_results; diff --git a/Src/Common/RootSite/RootSiteTests/RenderVerifyTests.cs b/Src/Common/RootSite/RootSiteTests/RenderVerifyTests.cs index 82b7c97080..893f1bef07 100644 --- a/Src/Common/RootSite/RootSiteTests/RenderVerifyTests.cs +++ b/Src/Common/RootSite/RootSiteTests/RenderVerifyTests.cs @@ -3,6 +3,7 @@ // (http://www.gnu.org/licenses/lgpl-2.1.html) using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using SIL.FieldWorks.Common.RootSites.RenderBenchmark; @@ -22,6 +23,7 @@ namespace SIL.FieldWorks.Common.RootSites /// [TestFixture] [Category("RenderBenchmark")] + [Apartment(ApartmentState.STA)] public class RenderVerifyTests : RenderBenchmarkTestsBase { ///