Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@@ -20,7 +20,7 @@ namespace Microsoft.Runtime.Hosting {
[ThreadStatic]
private static IClrStrongName s_StrongName;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
private static IClrStrongName StrongName {
[System.Security.SecurityCritical]
get {
@@ -33,7 +33,7 @@ namespace Microsoft.Runtime.Hosting {
}
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
private static IClrStrongNameUsingIntPtr StrongNameUsingIntPtr {
[System.Security.SecurityCritical]
get {
@@ -42,20 +42,20 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static int StrongNameErrorInfo() {
return ts_LastStrongNameHR;
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.Runtime.Hosting.IClrStrongNameUsingIntPtr.StrongNameFreeBuffer(System.IntPtr)", Justification = "StrongNameFreeBuffer returns void but the new runtime wrappers return an HRESULT.")]
public static void StrongNameFreeBuffer(IntPtr pbMemory) {
StrongNameUsingIntPtr.StrongNameFreeBuffer(pbMemory);
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameGetPublicKey(string pwzKeyContainer, IntPtr pbKeyBlob, int cbKeyBlob, out IntPtr ppbPublicKeyBlob, out int pcbPublicKeyBlob) {
int hr = StrongNameUsingIntPtr.StrongNameGetPublicKey(pwzKeyContainer, pbKeyBlob, cbKeyBlob, out ppbPublicKeyBlob, out pcbPublicKeyBlob);
if( hr < 0 )
@@ -70,7 +70,7 @@ namespace Microsoft.Runtime.Hosting {
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameKeyDelete(string pwzKeyContainer) {
int hr = StrongName.StrongNameKeyDelete(pwzKeyContainer);
if( hr < 0 )
@@ -82,7 +82,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameKeyGen(string pwzKeyContainer, int dwFlags, out IntPtr ppbKeyBlob, out int pcbKeyBlob) {
int hr = StrongName.StrongNameKeyGen(pwzKeyContainer, dwFlags, out ppbKeyBlob, out pcbKeyBlob);
if( hr < 0 )
@@ -96,7 +96,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameKeyInstall(string pwzKeyContainer, IntPtr pbKeyBlob, int cbKeyBlob) {
int hr = StrongNameUsingIntPtr.StrongNameKeyInstall(pwzKeyContainer, pbKeyBlob, cbKeyBlob);
if( hr < 0 )
@@ -108,7 +108,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureGeneration(string pwzFilePath, string pwzKeyContainer, IntPtr pbKeyBlob, int cbKeyBlob) {
IntPtr ppbSignatureBlob = IntPtr.Zero;
int cbSignatureBlob = 0;
@@ -117,7 +117,7 @@ namespace Microsoft.Runtime.Hosting {
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureGeneration(string pwzFilePath, string pwzKeyContainer, IntPtr pbKeyBlob, int cbKeyBlob, ref IntPtr ppbSignatureBlob, out int pcbSignatureBlob) {
int hr = StrongNameUsingIntPtr.StrongNameSignatureGeneration(pwzFilePath, pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, out pcbSignatureBlob);
if( hr < 0 )
@@ -130,7 +130,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureSize(IntPtr pbPublicKeyBlob, int cbPublicKeyBlob, out int pcbSize) {
int hr = StrongNameUsingIntPtr.StrongNameSignatureSize(pbPublicKeyBlob, cbPublicKeyBlob, out pcbSize);
if( hr < 0 )
@@ -143,7 +143,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureVerification(string pwzFilePath, int dwInFlags, out int pdwOutFlags) {
int hr = StrongName.StrongNameSignatureVerification(pwzFilePath, dwInFlags, out pdwOutFlags);
if( hr < 0 )
@@ -156,7 +156,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureVerificationEx(string pwzFilePath, bool fForceVerification, out bool pfWasVerified) {
int hr = StrongName.StrongNameSignatureVerificationEx(pwzFilePath, fForceVerification, out pfWasVerified);
if( hr < 0 )
@@ -169,7 +169,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameTokenFromPublicKey(IntPtr pbPublicKeyBlob, int cbPublicKeyBlob, out IntPtr ppbStrongNameToken, out int pcbStrongNameToken) {
int hr = StrongNameUsingIntPtr.StrongNameTokenFromPublicKey(pbPublicKeyBlob, cbPublicKeyBlob, out ppbStrongNameToken, out pcbStrongNameToken);
if( hr < 0 )
@@ -183,7 +183,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureSize(byte[] bPublicKeyBlob, int cbPublicKeyBlob, out int pcbSize) {
int hr = StrongName.StrongNameSignatureSize(bPublicKeyBlob, cbPublicKeyBlob, out pcbSize);
if( hr < 0 )
@@ -195,7 +195,7 @@ namespace Microsoft.Runtime.Hosting {
return true;
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameTokenFromPublicKey(byte[] bPublicKeyBlob, int cbPublicKeyBlob, out IntPtr ppbStrongNameToken, out int pcbStrongNameToken) {
int hr = StrongName.StrongNameTokenFromPublicKey(bPublicKeyBlob, cbPublicKeyBlob, out ppbStrongNameToken, out pcbStrongNameToken);
if( hr < 0 )
@@ -209,7 +209,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameGetPublicKey(string pwzKeyContainer, byte[] bKeyBlob, int cbKeyBlob, out IntPtr ppbPublicKeyBlob, out int pcbPublicKeyBlob) {
int hr = StrongName.StrongNameGetPublicKey(pwzKeyContainer, bKeyBlob, cbKeyBlob, out ppbPublicKeyBlob, out pcbPublicKeyBlob);
if( hr < 0 )
@@ -223,7 +223,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameKeyInstall(string pwzKeyContainer, byte[] bKeyBlob, int cbKeyBlob) {
int hr = StrongName.StrongNameKeyInstall(pwzKeyContainer, bKeyBlob, cbKeyBlob);
if( hr < 0 )
@@ -235,7 +235,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureGeneration(string pwzFilePath, string pwzKeyContainer, byte[] bKeyBlob, int cbKeyBlob) {
IntPtr ppbSignatureBlob = IntPtr.Zero;
int cbSignatureBlob = 0;
@@ -243,7 +243,7 @@ namespace Microsoft.Runtime.Hosting {
}
[System.Security.SecurityCritical]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "[....]: This file is included in a lot of projects some of which only use a subset of the functions.")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Microsoft: This file is included in a lot of projects some of which only use a subset of the functions.")]
public static bool StrongNameSignatureGeneration(string pwzFilePath, string pwzKeyContainer, byte[] bKeyBlob, int cbKeyBlob, ref IntPtr ppbSignatureBlob, out int pcbSignatureBlob) {
int hr = StrongName.StrongNameSignatureGeneration(pwzFilePath, pwzKeyContainer, bKeyBlob, cbKeyBlob, ppbSignatureBlob, out pcbSignatureBlob);
if( hr < 0 )

View File

@@ -60,7 +60,7 @@ namespace Microsoft.Win32 {
typeof(DBNull),
};
// Keep these numbers in [....] w/ the above array.
// Keep these numbers in sync w/ the above array.
private const int CV_OBJECT=0x12;
#endregion

View File

@@ -6,7 +6,7 @@
//
// File: SafeRegistryHandle.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
//
// Implements Microsoft.Win32.SafeHandles.SafeRegistryHandle
//

View File

@@ -1 +1 @@
e95c7ad15fc6ffe1097deff4285c70cb7a3bf96c
35fac908aaa66aff3ad8e3911047f71186a4fad7

View File

@@ -7,7 +7,7 @@
//
// AggregateException.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
//
// Public type to communicate multiple failures to an end-user.
//

View File

@@ -8,6 +8,19 @@ using System.Collections.Generic;
namespace System
{
//
// The AppContext class consists of a collection of APIs that applications can use to reason about the context
// in which they are running.
//
// One of the APIs that are available to the application (and the framework) are the ones related to the
// configuration switches (SetSwitch, TryGetSwitch). Those APIs are used to set and retrieve the value of a switch.
//
// Inside the framework we use those APIs to provide backward compatibility for our in-place updates. In order for
// that to work in as many cases as possible we have intentionally coded the APIs to use very low level concepts.
// For instance, we are directly P/Invoking into the Registry calls and so that we don't initialize the infrastructure
// for accessing registry. Doing that would allow us to use AppContext switches inside the Registry code.
//
public static class AppContext
{
[Flags]
@@ -18,7 +31,13 @@ namespace System
HasLookedForOverride = 0x4,
UnknownValue = 0x8 // Has no default and could not find an override
}
// The Dictionary is intentionally left without specifying the comparer. StringComparer.Ordinal for instance will
// end up pulling in Globalization since all StringComparers are initialized in the static constructor (including the
// ones that use CultureInfo).
// Not specifying a comparer means that the dictionary will end up with a GenericEqualityComparer<string> comparer
private static readonly Dictionary<string, SwitchValueState> s_switchMap = new Dictionary<string, SwitchValueState>();
private static volatile bool s_defaultsInitialized = false;
public static string BaseDirectory
{
@@ -37,21 +56,35 @@ namespace System
{
get
{
throw new NotImplementedException();
// Forward the value that is set on the current domain.
return AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName;
}
}
public static object GetData (string name)
#if FEATURE_CORECLR
[System.Security.SecuritySafeCritical]
#endif
public static object GetData(string name)
{
throw new NotImplementedException();
return AppDomain.CurrentDomain.GetData(name);
}
#region Switch APIs
static AppContext()
private static void InitializeDefaultSwitchValues()
{
// populate the AppContext with the default set of values
AppContextDefaultValues.PopulateDefaultValues();
}
// To save a method call into this method, we are first checking
// the value of s_defaultsInitialized in the caller.
lock (s_switchMap)
{
if (s_defaultsInitialized == false)
{
// populate the AppContext with the default set of values
AppContextDefaultValues.PopulateDefaultValues();
s_defaultsInitialized = true;
}
}
}
/// <summary>
/// Try to get the value of the switch.
@@ -66,6 +99,14 @@ namespace System
if (switchName.Length == 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
if (s_defaultsInitialized == false)
{
InitializeDefaultSwitchValues();
}
#if DEBUG
BCLDebug.Assert(s_defaultsInitialized == true, "AppContext defaults should have been initialized.");
#endif
// By default, the switch is not enabled.
isEnabled = false;
@@ -158,6 +199,14 @@ namespace System
if (switchName.Length == 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
if (s_defaultsInitialized == false)
{
InitializeDefaultSwitchValues();
}
#if DEBUG
BCLDebug.Assert(s_defaultsInitialized == true, "AppContext defaults should have been initialized.");
#endif
SwitchValueState switchValue = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride;
lock (s_switchMap)
@@ -169,13 +218,30 @@ namespace System
/// <summary>
/// This method is going to be called from the AppContextDefaultValues class when setting up the
/// default values for the switches. !!!! This method is called during the static constructor so it does not
/// take a lock !!!! If you are planning to use this outside of that, please ensure proper locking.
/// default values for the switches.
/// </summary>
internal static void DefineSwitchDefault(string switchName, bool isEnabled)
{
#if DEBUG
BCLDebug.Assert(System.Threading.Monitor.IsEntered(s_switchMap), "Expected the method to be called within a lock");
#endif
s_switchMap[switchName] = isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue;
}
/// <summary>
/// This method is going to be called from the AppContextDefaultValues class when setting up the
/// override default values for the switches.
/// </summary>
internal static void DefineSwitchOverride(string switchName, bool isEnabled)
{
#if DEBUG
BCLDebug.Assert(System.Threading.Monitor.IsEntered(s_switchMap), "Expected the method to be called within a lock");
#endif
s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride;
}
#endregion
}
}

View File

@@ -1,4 +1,4 @@
// ==++==
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
@@ -15,9 +15,9 @@ namespace System
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 SwitchDoNotAddrOfCspParentWindowHandle = "Switch.System.Security.Cryptography.DoNotAddrOfCspParentWindowHandle";
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
@@ -52,6 +52,11 @@ namespace System
AppContext.DefineSwitchDefault(SwitchSetActorAsReferenceWhenCopyingClaimsIdentity, true);
}
if (version <= 40602)
{
AppContext.DefineSwitchDefault(SwitchDoNotAddrOfCspParentWindowHandle, true);
}
break;
}
case "WindowsPhone":
@@ -63,6 +68,7 @@ namespace System
AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
AppContext.DefineSwitchDefault(SwitchDoNotAddrOfCspParentWindowHandle, true);
}
break;
}

View File

@@ -5,6 +5,7 @@
// ==--==
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -55,7 +56,7 @@ namespace System
if (bool.TryParse(value, out switchValue))
{
// If multiple switches have the same name, the last value that we find will win.
AppContext.SetSwitch(name, switchValue);
AppContext.DefineSwitchOverride(name, switchValue);
}
}
previousSemicolonPos = currentPos;
@@ -96,10 +97,10 @@ namespace System
overrideFound = false;
// Read the value from the registry if we can (ie. the key exists)
if (s_switchesRegKey != null)
if (s_errorReadingRegistry != true)
{
// try to read it from the registry key and return null if the switch name is not found
valueFromConfig = s_switchesRegKey.GetValue(switchName, (string)null) as string;
valueFromConfig = GetSwitchValueFromRegistry(switchName);
}
// Note: valueFromConfig will be null only if the key is not found.
@@ -118,19 +119,44 @@ namespace System
}
}
// Cached registry key used to read value overrides from the registry
private static RegistryKey s_switchesRegKey = OpenRegKeyNoThrow();
/// <summary>
/// Opens the registry key where the switches are stored and returns null if there is an issue opening the key
/// </summary>
private static RegistryKey OpenRegKeyNoThrow()
private volatile static bool s_errorReadingRegistry;
[SecuritySafeCritical]
private static string GetSwitchValueFromRegistry(string switchName)
{
//
// We are using P/Invokes directly instead of using the RegistryKey class to avoid pulling in the
// globalization stack that is required by RegistryKey.
//
const string REG_KEY_APPCONTEXT = @"SOFTWARE\Microsoft\.NETFramework\AppContext";
try
{
return Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework\AppContext");
using (SafeRegistryHandle hklm = new SafeRegistryHandle((IntPtr)RegistryHive.LocalMachine, true))
{
SafeRegistryHandle hkey = null;
if (Win32Native.RegOpenKeyEx(hklm, REG_KEY_APPCONTEXT, 0, Win32Native.KEY_READ, out hkey) == 0)
{
int size = 6; // "false".Length+1
int type = 0;
System.Text.StringBuilder keyBuffer = new System.Text.StringBuilder((int)size);
if (Win32Native.RegQueryValueEx(hkey, switchName, null, ref type, keyBuffer, ref size) == 0)
{
return keyBuffer.ToString();
}
}
else
{
// If we could not open the AppContext key, don't try it again.
s_errorReadingRegistry = true;
}
}
}
catch { return null; }
catch
{
// If there was an error, flag it so that we don't try this again.
s_errorReadingRegistry = true;
}
return null;
}
}
}

View File

@@ -88,6 +88,16 @@ namespace System
}
}
private static int _doNotAddrOfCspParentWindowHandle;
public static bool DoNotAddrOfCspParentWindowHandle
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return GetCachedSwitchValue(AppContextDefaultValues.SwitchDoNotAddrOfCspParentWindowHandle, ref _doNotAddrOfCspParentWindowHandle);
}
}
//
// Implementation details
//

View File

@@ -8,7 +8,7 @@
//
// Lazy.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
//
// --------------------------------------------------------------------------------------
//
@@ -431,7 +431,7 @@ namespace System
}
else if (factory == ALREADY_INVOKED_SENTINEL)
{
// Another thread ----d with us and beat us to successfully invoke the factory.
// Another thread raced with us and beat us to successfully invoke the factory.
return null;
}
boxed = new Boxed(factory());

View File

@@ -1 +1 @@
2a704e83006fa15410f41e5e15bbe8ae7ddd0a4f
0b475ce301b6852aeb4b78b21cbe7df6c4baa365

View File

@@ -7,7 +7,7 @@
**
** File: AppDomainAttributes
**
** <OWNER>[....]</OWNER>
** <OWNER>Microsoft</OWNER>
**
**
** Purpose: For AppDomain-related custom attributes.

View File

@@ -7,7 +7,7 @@
**
** Class: AppDomainUnloadedException
**
** <OWNER>[....]</OWNER>
** <OWNER>Microsoft</OWNER>
**
**
** Purpose: Exception class for attempt to access an unloaded AppDomain

View File

@@ -13,7 +13,7 @@ namespace System {
// This class will not be marked serializable
// Note: This type must have the same layout as the CLR's VARARGS type in CLRVarArgs.h.
// It also contains an inline SigPointer data structure - must keep those fields in [....].
// It also contains an inline SigPointer data structure - must keep those fields in sync.
[StructLayout(LayoutKind.Sequential)]
public struct ArgIterator
{

View File

@@ -1 +1 @@
7c767692fef9860facfa00e85ad8d5930fb954df
3c678360dfc5ead76993bd3253a40779452a4054

View File

@@ -12,7 +12,7 @@
**
**
===========================================================*/
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
namespace System {

View File

@@ -7,7 +7,7 @@
**
** Class: CannotUnloadAppDomainException
**
** <OWNER>[....]</OWNER>
** <OWNER>Microsoft</OWNER>
**
**
** Purpose: Exception class for failed attempt to unload an AppDomain.

View File

@@ -7,7 +7,7 @@
//
// CDSCollectionETWBCLProvider.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
//
// A helper class for firing ETW events related to the Coordination Data Structure
// collection types. This provider is used by CDS collections in both mscorlib.dll

View File

@@ -4,7 +4,7 @@
//
// ==--==
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
/*============================================================
**
** Class: ConcurrentDictionary

View File

@@ -9,7 +9,7 @@
//
// ConcurrentQueue.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>Microsoft</OWNER>
//
// A lock-free, concurrent queue primitive, and its associated debugger view type.
//

Some files were not shown because too many files have changed in this diff Show More