You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
@@ -18,8 +18,7 @@ namespace System
|
||||
HasLookedForOverride = 0x4,
|
||||
UnknownValue = 0x8 // Has no default and could not find an override
|
||||
}
|
||||
private static Dictionary<string, SwitchValueState> s_switchMap = new Dictionary<string, SwitchValueState>();
|
||||
private static readonly object s_syncLock = new object();
|
||||
private static readonly Dictionary<string, SwitchValueState> s_switchMap = new Dictionary<string, SwitchValueState>();
|
||||
|
||||
public static string BaseDirectory
|
||||
{
|
||||
@@ -166,11 +165,12 @@ namespace System
|
||||
if (switchName.Length == 0)
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
|
||||
|
||||
lock (s_syncLock)
|
||||
SwitchValueState switchValue = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
|
||||
| SwitchValueState.HasLookedForOverride;
|
||||
lock (s_switchMap)
|
||||
{
|
||||
// Store the new value and the fact that we checked in the dictionary
|
||||
s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
|
||||
| SwitchValueState.HasLookedForOverride;
|
||||
s_switchMap[switchName] = switchValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// ==++==
|
||||
// ==++==
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
@@ -13,8 +13,11 @@ namespace System
|
||||
internal static readonly string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
|
||||
internal static readonly string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
|
||||
internal static readonly string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
|
||||
internal static readonly string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";
|
||||
internal static readonly string SwitchBlockLongPaths = "Switch.System.IO.BlockLongPaths";
|
||||
internal static readonly string SwitchSetActorAsReferenceWhenCopyingClaimsIdentity = "Switch.System.Security.ClaimsIdentity.SetActorAsReferenceWhenCopyingClaimsIdentity";
|
||||
|
||||
|
||||
|
||||
// This is a partial method. Platforms can provide an implementation of it that will set override values
|
||||
// from whatever mechanism is available on that platform. If no implementation is provided, the compiler is going to remove the calls
|
||||
// to it from the code
|
||||
@@ -41,6 +44,14 @@ namespace System
|
||||
AppContext.DefineSwitchDefault(SwitchNoAsyncCurrentCulture, true);
|
||||
AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
|
||||
}
|
||||
|
||||
if (version <= 40601)
|
||||
{
|
||||
AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
|
||||
AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
|
||||
AppContext.DefineSwitchDefault(SwitchSetActorAsReferenceWhenCopyingClaimsIdentity, true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case "WindowsPhone":
|
||||
@@ -50,6 +61,8 @@ namespace System
|
||||
{
|
||||
AppContext.DefineSwitchDefault(SwitchNoAsyncCurrentCulture, true);
|
||||
AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
|
||||
AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
|
||||
AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// ==--==
|
||||
|
||||
// There are cases where we have multiple assemblies that are going to import this file and
|
||||
// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
|
||||
// that the type is found both in the source and in a referenced assembly. The compiler will prefer
|
||||
// the version of the type defined in the source
|
||||
//
|
||||
// In order to disable the warning for this type we are disabling this warning for this entire file.
|
||||
#pragma warning disable 436
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -167,3 +176,5 @@ namespace System
|
||||
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore 436
|
||||
|
||||
@@ -41,6 +41,48 @@ namespace System
|
||||
}
|
||||
}
|
||||
|
||||
private static int _useLegacyPathHandling;
|
||||
|
||||
/// <summary>
|
||||
/// Use legacy path normalization logic and blocking of extended syntax.
|
||||
/// </summary>
|
||||
public static bool UseLegacyPathHandling
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchUseLegacyPathHandling, ref _useLegacyPathHandling);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _blockLongPaths;
|
||||
|
||||
/// <summary>
|
||||
/// Throw PathTooLongException for paths greater than MAX_PATH or directories greater than 248 (as per CreateDirectory Win32 limitations)
|
||||
/// </summary>
|
||||
public static bool BlockLongPaths
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchBlockLongPaths, ref _blockLongPaths);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _cloneActor;
|
||||
|
||||
/// <summary>
|
||||
/// When copying a ClaimsIdentity.Actor this switch controls whether ClaimsIdentity.Actor should be set as a reference or the result of Actor.Clone()
|
||||
/// </summary>
|
||||
public static bool SetActorAsReferenceWhenCopyingClaimsIdentity
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return GetCachedSwitchValue(AppContextDefaultValues.SwitchSetActorAsReferenceWhenCopyingClaimsIdentity, ref _cloneActor);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Implementation details
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user