Imported Upstream version 5.0.0.94

Former-commit-id: 09772966aff74491c7b98b6eda49852cfc4aa874
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-05-03 16:24:32 +00:00
parent 5c980d35e6
commit 67a5eefa39
30 changed files with 191 additions and 38 deletions

View File

@ -49,13 +49,13 @@ namespace System
#endif
#region Switch APIs
#if !MONO
static AppContext()
{
// populate the AppContext with the default set of values
AppContextDefaultValues.PopulateDefaultValues();
}
#endif
/// <summary>
/// Try to get the value of the switch.
/// </summary>
@ -102,7 +102,6 @@ namespace System
{
return true;
}
#if !MONO
// 3. The switch has a valid value, but we need to check for overrides.
// Regardless of whether or not the switch has an override, we need to update the value to reflect
// the fact that we checked for overrides.
@ -112,7 +111,6 @@ namespace System
// we found an override!
isEnabled = overrideValue;
}
#endif
// Update the switch in the dictionary to mark it as 'checked for override'
s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride;
@ -132,7 +130,6 @@ namespace System
// In this case, we want to capture the fact that we looked for a value and found nothing by adding
// an entry in the dictionary with the 'sentinel' value of 'SwitchValueState.UnknownValue'.
// Example: This will prevent us from trying to find overrides for values that we don't have in the dictionary
#if !MONO
// 1. The value has an override specified.
bool overrideValue;
if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out overrideValue))
@ -145,7 +142,6 @@ namespace System
return true;
}
#endif
// 2. The value does not have an override.
s_switchMap[switchName] = SwitchValueState.UnknownValue;
}

View File

@ -11,6 +11,11 @@ namespace System
internal static class AppContextSwitches
{
#if MOBILE
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = false;
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
public static readonly bool NoAsyncCurrentCulture = false;
#else
private static int _noAsyncCurrentCulture;
public static bool NoAsyncCurrentCulture
{
@ -120,5 +125,6 @@ namespace System
switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/;
return isSwitchEnabled;
}
#endif
}
}