From 9cc490e89f635db3712d8e955e85b232a4c3f560 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sun, 24 Dec 2023 19:05:37 -0800 Subject: [PATCH] Ensure that ICU is loaded in tests before checking its version (#96288) Fixes #96279 --- .../Common/tests/TestUtilities/System/PlatformDetection.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index ac7d5e5a3ee6d8..f3a8aae9b38fd6 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -424,6 +424,9 @@ private static Version GetICUVersion() MethodInfo methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static); if (methodInfo != null) { + // Ensure that ICU has been loaded + GC.KeepAlive(System.Globalization.CultureInfo.InstalledUICulture); + version = (int)methodInfo.Invoke(null, null); } }