@@ -23,7 +23,7 @@ public static partial class PlatformDetection
23
23
// do it in a way that failures don't cascade.
24
24
//
25
25
26
- private static Lazy < bool > s_IsInHelix => new Lazy < bool > ( ( ) => Environment . GetEnvironmentVariables ( ) . Keys . Cast < string > ( ) . Any ( key => key . StartsWith ( "HELIX" ) ) ) ;
26
+ private static readonly Lazy < bool > s_IsInHelix = new Lazy < bool > ( ( ) => Environment . GetEnvironmentVariables ( ) . Keys . Cast < string > ( ) . Any ( key => key . StartsWith ( "HELIX" ) ) ) ;
27
27
public static bool IsInHelix => s_IsInHelix . Value ;
28
28
29
29
public static bool IsNetCore => Environment . Version . Major >= 5 || RuntimeInformation . FrameworkDescription . StartsWith ( ".NET Core" , StringComparison . OrdinalIgnoreCase ) ;
@@ -66,9 +66,9 @@ public static partial class PlatformDetection
66
66
public static bool Is64BitProcess => IntPtr . Size == 8 ;
67
67
public static bool IsNotWindows => ! IsWindows ;
68
68
69
- private static Lazy < bool > s_isCheckedRuntime => new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Checked" ) ) ;
70
- private static Lazy < bool > s_isReleaseRuntime => new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Release" ) ) ;
71
- private static Lazy < bool > s_isDebugRuntime => new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Debug" ) ) ;
69
+ private static readonly Lazy < bool > s_isCheckedRuntime = new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Checked" ) ) ;
70
+ private static readonly Lazy < bool > s_isReleaseRuntime = new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Release" ) ) ;
71
+ private static readonly Lazy < bool > s_isDebugRuntime = new Lazy < bool > ( ( ) => AssemblyConfigurationEquals ( "Debug" ) ) ;
72
72
73
73
public static bool IsCheckedRuntime => s_isCheckedRuntime . Value ;
74
74
public static bool IsReleaseRuntime => s_isReleaseRuntime . Value ;
@@ -209,7 +209,7 @@ public static bool IsMetadataTokenSupported
209
209
// Linux - OpenSsl supports alpn from openssl 1.0.2 and higher.
210
210
// OSX - SecureTransport doesn't expose alpn APIs. TODO https://github.com/dotnet/runtime/issues/27727
211
211
// Android - Platform supports alpn from API level 29 and higher
212
- private static Lazy < bool > s_supportsAlpn = new Lazy < bool > ( GetAlpnSupport ) ;
212
+ private static readonly Lazy < bool > s_supportsAlpn = new Lazy < bool > ( GetAlpnSupport ) ;
213
213
private static bool GetAlpnSupport ( )
214
214
{
215
215
if ( IsWindows && ! IsWindows7 && ! IsNetFramework )
@@ -238,11 +238,11 @@ private static bool GetAlpnSupport()
238
238
public static bool SupportsAlpn => s_supportsAlpn . Value ;
239
239
public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsMacCatalyst || IsiOS || IstvOS ;
240
240
241
- private static Lazy < bool > s_supportsTls10 = new Lazy < bool > ( GetTls10Support ) ;
242
- private static Lazy < bool > s_supportsTls11 = new Lazy < bool > ( GetTls11Support ) ;
243
- private static Lazy < bool > s_supportsTls12 = new Lazy < bool > ( GetTls12Support ) ;
244
- private static Lazy < bool > s_supportsTls13 = new Lazy < bool > ( GetTls13Support ) ;
245
- private static Lazy < bool > s_sendsCAListByDefault = new Lazy < bool > ( GetSendsCAListByDefault ) ;
241
+ private static readonly Lazy < bool > s_supportsTls10 = new Lazy < bool > ( GetTls10Support ) ;
242
+ private static readonly Lazy < bool > s_supportsTls11 = new Lazy < bool > ( GetTls11Support ) ;
243
+ private static readonly Lazy < bool > s_supportsTls12 = new Lazy < bool > ( GetTls12Support ) ;
244
+ private static readonly Lazy < bool > s_supportsTls13 = new Lazy < bool > ( GetTls13Support ) ;
245
+ private static readonly Lazy < bool > s_sendsCAListByDefault = new Lazy < bool > ( GetSendsCAListByDefault ) ;
246
246
247
247
public static bool SupportsTls10 => s_supportsTls10 . Value ;
248
248
public static bool SupportsTls11 => s_supportsTls11 . Value ;
@@ -251,7 +251,7 @@ private static bool GetAlpnSupport()
251
251
public static bool SendsCAListByDefault => s_sendsCAListByDefault . Value ;
252
252
public static bool SupportsSendingCustomCANamesInTls => UsesAppleCrypto || IsOpenSslSupported || ( PlatformDetection . IsWindows8xOrLater && SendsCAListByDefault ) ;
253
253
254
- private static Lazy < bool > s_largeArrayIsNotSupported = new Lazy < bool > ( IsLargeArrayNotSupported ) ;
254
+ private static readonly Lazy < bool > s_largeArrayIsNotSupported = new Lazy < bool > ( IsLargeArrayNotSupported ) ;
255
255
256
256
[ MethodImpl ( MethodImplOptions . NoOptimization ) ]
257
257
private static bool IsLargeArrayNotSupported ( )
0 commit comments