diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 87e064b2ec413..f92ec2a8c0bb2 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -23,7 +23,8 @@ public static partial class PlatformDetection // do it in a way that failures don't cascade. // - public static readonly bool IsInHelix = Environment.GetEnvironmentVariables().Keys.Cast().Where(key => key.StartsWith("HELIX")).Any(); + private static Lazy s_IsInHelix => new Lazy(() => Environment.GetEnvironmentVariables().Keys.Cast().Any(key => key.StartsWith("HELIX"))); + public static bool IsInHelix => s_IsInHelix.Value; public static bool IsNetCore => Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;