@@ -33,10 +33,16 @@ public sealed class LocalAppContextSwitchesHelper : IDisposable
3333 private readonly PropertyInfo _truncateScaledDecimalProperty ;
3434 private readonly PropertyInfo _ignoreServerProvidedFailoverPartner ;
3535 private readonly PropertyInfo _enableUserAgent ;
36- #if NET
36+
37+ #if NET
3738 private readonly PropertyInfo _globalizationInvariantModeProperty ;
39+ #endif
40+
41+ #if NET && _WINDOWS
3842 private readonly PropertyInfo _useManagedNetworkingProperty ;
39- #else
43+ #endif
44+
45+ #if NETFRAMEWORK
4046 private readonly PropertyInfo _disableTnirByDefaultProperty ;
4147 #endif
4248
@@ -63,12 +69,18 @@ public sealed class LocalAppContextSwitchesHelper : IDisposable
6369 private readonly Tristate _ignoreServerProvidedFailoverPartnerOriginal ;
6470 private readonly FieldInfo _enableUserAgentField ;
6571 private readonly Tristate _enableUserAgentOriginal ;
66- #if NET
72+
73+ #if NET
6774 private readonly FieldInfo _globalizationInvariantModeField ;
6875 private readonly Tristate _globalizationInvariantModeOriginal ;
76+ #endif
77+
78+ #if NET && _WINDOWS
6979 private readonly FieldInfo _useManagedNetworkingField ;
7080 private readonly Tristate _useManagedNetworkingOriginal ;
71- #else
81+ #endif
82+
83+ #if NETFRAMEWORK
7284 private readonly FieldInfo _disableTnirByDefaultField ;
7385 private readonly Tristate _disableTnirByDefaultOriginal ;
7486 #endif
@@ -169,15 +181,19 @@ void InitProperty(string name, out PropertyInfo property)
169181 "EnableUserAgent" ,
170182 out _enableUserAgent ) ;
171183
172- #if NET
184+ #if NET
173185 InitProperty (
174186 "GlobalizationInvariantMode" ,
175187 out _globalizationInvariantModeProperty ) ;
176-
188+ #endif
189+
190+ #if NET && _WINDOWS
177191 InitProperty (
178192 "UseManagedNetworking" ,
179193 out _useManagedNetworkingProperty ) ;
180- #else
194+ #endif
195+
196+ #if NETFRAMEWORK
181197 InitProperty (
182198 "DisableTnirByDefault" ,
183199 out _disableTnirByDefaultProperty ) ;
@@ -253,17 +269,21 @@ void InitField(string name, out FieldInfo field, out Tristate value)
253269 out _enableUserAgentField ,
254270 out _enableUserAgentOriginal ) ;
255271
256- #if NET
272+ #if NET
257273 InitField (
258274 "s_globalizationInvariantMode" ,
259275 out _globalizationInvariantModeField ,
260276 out _globalizationInvariantModeOriginal ) ;
261-
277+ #endif
278+
279+ #if NET && _WINDOWS
262280 InitField (
263281 "s_useManagedNetworking" ,
264282 out _useManagedNetworkingField ,
265283 out _useManagedNetworkingOriginal ) ;
266- #else
284+ #endif
285+
286+ #if NETFRAMEWORK
267287 InitField (
268288 "s_disableTnirByDefault" ,
269289 out _disableTnirByDefaultField ,
@@ -339,15 +359,19 @@ void RestoreField(FieldInfo field, Tristate value)
339359 _enableUserAgentField ,
340360 _enableUserAgentOriginal ) ;
341361
342- #if NET
362+ #if NET
343363 RestoreField (
344364 _globalizationInvariantModeField ,
345365 _globalizationInvariantModeOriginal ) ;
346-
366+ #endif
367+
368+ #if NET && _WINDOWS
347369 RestoreField (
348370 _useManagedNetworkingField ,
349371 _useManagedNetworkingOriginal ) ;
350- #else
372+ #endif
373+
374+ #if NETFRAMEWORK
351375 RestoreField (
352376 _disableTnirByDefaultField ,
353377 _disableTnirByDefaultOriginal ) ;
@@ -450,23 +474,27 @@ public bool EnableUserAgent
450474 get => ( bool ) _enableUserAgent . GetValue ( null ) ;
451475 }
452476
453- #if NET
477+ #if NET
454478 /// <summary>
455479 /// Access the LocalAppContextSwitches.GlobalizationInvariantMode property.
456480 /// </summary>
457481 public bool GlobalizationInvariantMode
458482 {
459483 get => ( bool ) _globalizationInvariantModeProperty . GetValue ( null ) ;
460484 }
485+ #endif
461486
487+ #if NET && _WINDOWS
462488 /// <summary>
463489 /// Access the LocalAppContextSwitches.UseManagedNetworking property.
464490 /// </summary>
465491 public bool UseManagedNetworking
466492 {
467493 get => ( bool ) _useManagedNetworkingProperty . GetValue ( null ) ;
468494 }
469- #else
495+ #endif
496+
497+ #if NETFRAMEWORK
470498 /// <summary>
471499 /// Access the LocalAppContextSwitches.DisableTnirByDefault property.
472500 /// </summary>
@@ -580,7 +608,7 @@ public Tristate EnableUserAgentField
580608 set => SetValue ( _enableUserAgentField , value ) ;
581609 }
582610
583- #if NET
611+ #if NET
584612 /// <summary>
585613 /// Get or set the LocalAppContextSwitches.GlobalizationInvariantMode switch value.
586614 /// </summary>
@@ -589,7 +617,9 @@ public Tristate GlobalizationInvariantModeField
589617 get => GetValue ( _globalizationInvariantModeField ) ;
590618 set => SetValue ( _globalizationInvariantModeField , value ) ;
591619 }
620+ #endif
592621
622+ #if NET && _WINDOWS
593623 /// <summary>
594624 /// Get or set the LocalAppContextSwitches.UseManagedNetworking switch value.
595625 /// </summary>
@@ -598,7 +628,9 @@ public Tristate UseManagedNetworkingField
598628 get => GetValue ( _useManagedNetworkingField ) ;
599629 set => SetValue ( _useManagedNetworkingField , value ) ;
600630 }
601- #else
631+ #endif
632+
633+ #if NETFRAMEWORK
602634 /// <summary>
603635 /// Get or set the LocalAppContextSwitches.DisableTnirByDefault switch
604636 /// value.
0 commit comments