From: Jan Kotas Date: Sun, 16 Apr 2017 22:14:48 +0000 (-0700) Subject: Move a few more files to shared CoreLib partition X-Git-Tag: submit/tizen/20210909.063632~11030^2~7058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b41aae20212063893d92b40afcca2d531ea9d2e;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Move a few more files to shared CoreLib partition Commit migrated from https://github.com/dotnet/coreclr/commit/b11928aa219f3caded8ba39a946cf4bec9b7b5ed --- diff --git a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj index f00baa2..a7fb42b 100644 --- a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj @@ -314,10 +314,8 @@ - - @@ -634,11 +632,8 @@ - - - @@ -661,7 +656,6 @@ - diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleMinusOneIsInvalid.cs new file mode 100644 index 0000000..5415f2c --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleMinusOneIsInvalid.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + // Class of safe handle which uses only -1 as an invalid handle. + public abstract class SafeHandleMinusOneIsInvalid : SafeHandle + { + protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle) + { + } + + public override bool IsInvalid => handle == new IntPtr(-1); + } +} diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs new file mode 100644 index 0000000..8d0220b --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + // Class of safe handle which uses 0 or -1 as an invalid handle. + public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle + { + protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero || handle == new IntPtr(-1); + } +} diff --git a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index 5a6cbf4..00d0796 100644 --- a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -16,10 +16,13 @@ + + + @@ -27,6 +30,7 @@ + @@ -253,7 +257,10 @@ + + + @@ -275,8 +282,8 @@ - + @@ -355,9 +362,9 @@ + - diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs b/src/coreclr/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs similarity index 73% rename from src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs rename to src/coreclr/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs index 9083781..eeeadcb 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentOutOfRangeException.cs +++ b/src/coreclr/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs @@ -11,43 +11,28 @@ ** =============================================================================*/ - -using System; -using System.Runtime.Remoting; -using System.Runtime.Serialization; using System.Globalization; -using System.Diagnostics.Contracts; +using System.Runtime.Serialization; namespace System { // The ArgumentOutOfRangeException is thrown when an argument // is outside the legal range for that argument. [Serializable] - public class ArgumentOutOfRangeException : ArgumentException, ISerializable + public class ArgumentOutOfRangeException : ArgumentException { - private static volatile String _rangeMessage; - private Object m_actualValue; - - private static String RangeMessage - { - get - { - if (_rangeMessage == null) - _rangeMessage = SR.Arg_ArgumentOutOfRangeException; - return _rangeMessage; - } - } + private Object _actualValue; // Creates a new ArgumentOutOfRangeException with its message // string set to a default message explaining an argument was out of range. public ArgumentOutOfRangeException() - : base(RangeMessage) + : base(SR.Arg_ArgumentOutOfRangeException) { HResult = __HResults.COR_E_ARGUMENTOUTOFRANGE; } public ArgumentOutOfRangeException(String paramName) - : base(RangeMessage, paramName) + : base(SR.Arg_ArgumentOutOfRangeException, paramName) { HResult = __HResults.COR_E_ARGUMENTOUTOFRANGE; } @@ -70,18 +55,30 @@ namespace System public ArgumentOutOfRangeException(String paramName, Object actualValue, String message) : base(message, paramName) { - m_actualValue = actualValue; + _actualValue = actualValue; HResult = __HResults.COR_E_ARGUMENTOUTOFRANGE; } + protected ArgumentOutOfRangeException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _actualValue = info.GetValue("ActualValue", typeof(Object)); + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("ActualValue", _actualValue, typeof(Object)); + } + public override String Message { get { String s = base.Message; - if (m_actualValue != null) + if (_actualValue != null) { - String valueMessage = SR.Format(SR.ArgumentOutOfRange_ActualValue, m_actualValue.ToString()); + String valueMessage = SR.Format(SR.ArgumentOutOfRange_ActualValue, _actualValue.ToString()); if (s == null) return valueMessage; return s + Environment.NewLine + valueMessage; @@ -96,23 +93,7 @@ namespace System // want to avoid sticking printf's in their code. public virtual Object ActualValue { - get { return m_actualValue; } - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - if (info == null) - { - throw new ArgumentNullException(nameof(info)); - } - Contract.EndContractBlock(); - base.GetObjectData(info, context); - info.AddValue("ActualValue", m_actualValue, typeof(Object)); - } - - protected ArgumentOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context) - { - m_actualValue = info.GetValue("ActualValue", typeof(Object)); + get { return _actualValue; } } } } diff --git a/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs b/src/coreclr/src/mscorlib/shared/System/BadImageFormatException.cs similarity index 64% rename from src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs rename to src/coreclr/src/mscorlib/shared/System/BadImageFormatException.cs index 42005cc..eb4c3a6e 100644 --- a/src/coreclr/src/mscorlib/src/System/BadImageFormatException.cs +++ b/src/coreclr/src/mscorlib/shared/System/BadImageFormatException.cs @@ -11,14 +11,12 @@ ** ===========================================================*/ +using System.Globalization; +using System.IO; +using System.Runtime.Serialization; + namespace System { - using System; - using System.Runtime.Serialization; - using FileLoadException = System.IO.FileLoadException; - using SecurityException = System.Security.SecurityException; - using System.Globalization; - [Serializable] public class BadImageFormatException : SystemException { @@ -56,6 +54,21 @@ namespace System _fileName = fileName; } + protected BadImageFormatException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _fileName = info.GetString("BadImageFormat_FileName"); + _fusionLog = info.GetString("BadImageFormat_FusionLog"); + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + + info.AddValue("BadImageFormat_FileName", _fileName, typeof(String)); + info.AddValue("BadImageFormat_FusionLog", _fusionLog, typeof(String)); + } + public override String Message { get @@ -70,7 +83,7 @@ namespace System if (_message == null) { if ((_fileName == null) && - (HResult == System.__HResults.COR_E_EXCEPTION)) + (HResult == __HResults.COR_E_EXCEPTION)) _message = SR.Arg_BadImageFormatException; else @@ -85,7 +98,7 @@ namespace System public override String ToString() { - String s = GetType().FullName + ": " + Message; + String s = GetType().ToString() + ": " + Message; if (_fileName != null && _fileName.Length != 0) s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, _fileName); @@ -95,68 +108,22 @@ namespace System if (StackTrace != null) s += Environment.NewLine + StackTrace; - try - { - if (FusionLog != null) - { - if (s == null) - s = " "; - s += Environment.NewLine; - s += Environment.NewLine; - s += FusionLog; - } - } - catch (SecurityException) - { - } - return s; - } - protected BadImageFormatException(SerializationInfo info, StreamingContext context) : base(info, context) - { - // Base class constructor will check info != null. - - _fileName = info.GetString("BadImageFormat_FileName"); - try + if (_fusionLog != null) { - _fusionLog = info.GetString("BadImageFormat_FusionLog"); + if (s == null) + s = " "; + s += Environment.NewLine; + s += Environment.NewLine; + s += _fusionLog; } - catch - { - _fusionLog = null; - } - } - private BadImageFormatException(String fileName, String fusionLog, int hResult) - : base(null) - { - HResult = hResult; - _fileName = fileName; - _fusionLog = fusionLog; - SetMessageField(); + return s; } public String FusionLog { -#pragma warning disable CS0618 // Type or member is obsolete -#pragma warning restore CS0618 // Type or member is obsolete get { return _fusionLog; } } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - // Serialize data for our base classes. base will verify info != null. - base.GetObjectData(info, context); - - // Serialize data for this class - info.AddValue("BadImageFormat_FileName", _fileName, typeof(String)); - try - { - info.AddValue("BadImageFormat_FusionLog", FusionLog, typeof(String)); - } - catch (SecurityException) - { - } - } } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceFallbackManager.cs similarity index 83% rename from src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/ResourceFallbackManager.cs index 4ad7b4c..8268f32 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceFallbackManager.cs @@ -30,15 +30,6 @@ namespace System.Resources private CultureInfo m_neutralResourcesCulture; private bool m_useParents; - // This is a cache of the thread, process, user, and OS-preferred fallback cultures. - // However, each thread may have a different value, and these may change during the - // lifetime of the process. So this cache must be verified each time we use it. - // Hence, we'll keep an array of strings for culture names & check it each time, - // but we'll really cache an array of CultureInfo's. Using thread-local statics - // as well to avoid differences across threads. - [ThreadStatic] - private static CultureInfo[] cachedOsFallbackArray; - internal ResourceFallbackManager(CultureInfo startingCulture, CultureInfo neutralResourcesCulture, bool useParents) { if (startingCulture != null) diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceSet.cs similarity index 69% rename from src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/ResourceSet.cs index 8775f64..18b9c1b 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceSet.cs @@ -13,36 +13,33 @@ ** ===========================================================*/ +using System; +using System.Collections; +using System.IO; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Versioning; +using System.Diagnostics.Contracts; +using System.Collections.Generic; + namespace System.Resources { - using System; - using System.Collections; - using System.IO; - using System.Globalization; - using System.Runtime.InteropServices; - using System.Reflection; - using System.Runtime.Serialization; - using System.Runtime.Versioning; - using System.Diagnostics.Contracts; - // A ResourceSet stores all the resources defined in one particular CultureInfo. // // The method used to load resources is straightforward - this class // enumerates over an IResourceReader, loading every name and value, and // stores them in a hash table. Custom IResourceReaders can be used. - // + // [Serializable] public class ResourceSet : IDisposable, IEnumerable { - [NonSerialized] protected IResourceReader Reader; - internal Hashtable Table; + [NonSerialized] + protected IResourceReader Reader; - private Hashtable _caseInsensitiveTable; // For case-insensitive lookups. - -#if LOOSELY_LINKED_RESOURCE_REFERENCE - [OptionalField] - private Assembly _assembly; // For LooselyLinkedResourceReferences -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE + private Dictionary _table; + private Dictionary _caseInsensitiveTable; // For case-insensitive lookups. protected ResourceSet() { @@ -68,16 +65,6 @@ namespace System.Resources ReadResources(); } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - public ResourceSet(String fileName, Assembly assembly) - { - Reader = new ResourceReader(fileName); - CommonInit(); - _assembly = assembly; - ReadResources(); - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE - // Creates a ResourceSet using the system default ResourceReader // implementation. Use this constructor to read from an open stream // of data. @@ -89,16 +76,6 @@ namespace System.Resources ReadResources(); } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - public ResourceSet(Stream stream, Assembly assembly) - { - Reader = new ResourceReader(stream); - CommonInit(); - _assembly = assembly; - ReadResources(); - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE - public ResourceSet(IResourceReader reader) { if (reader == null) @@ -109,22 +86,9 @@ namespace System.Resources ReadResources(); } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - public ResourceSet(IResourceReader reader, Assembly assembly) - { - if (reader == null) - throw new ArgumentNullException(nameof(reader)); - Contract.EndContractBlock(); - Reader = reader; - CommonInit(); - _assembly = assembly; - ReadResources(); - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE - private void CommonInit() { - Table = new Hashtable(); + _table = new Dictionary(); } // Closes and releases any resources used by this ResourceSet, if any. @@ -148,7 +112,7 @@ namespace System.Resources } Reader = null; _caseInsensitiveTable = null; - Table = null; + _table = null; } public void Dispose() @@ -156,15 +120,6 @@ namespace System.Resources Dispose(true); } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - // Optional - used for resolving assembly manifest resource references. - // This can safely be null. - public Assembly Assembly { - get { return _assembly; } - /*protected*/ set { _assembly = value; } - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE - // Returns the preferred IResourceReader class for this kind of ResourceSet. // Subclasses of ResourceSet using their own Readers &; should override // GetDefaultReader and GetDefaultWriter. @@ -178,7 +133,8 @@ namespace System.Resources // GetDefaultReader and GetDefaultWriter. public virtual Type GetDefaultWriter() { - return Type.GetType("System.Resources.ResourceWriter, System.Resources.Writer, Version=4.0.1.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.MicrosoftPublicKeyToken, throwOnError: true); + Assembly resourceWriterAssembly = Assembly.Load("System.Resources.Writer, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); + return resourceWriterAssembly.GetType("System.Resources.ResourceWriter", true); } public virtual IDictionaryEnumerator GetEnumerator() @@ -193,7 +149,7 @@ namespace System.Resources private IDictionaryEnumerator GetEnumeratorHelper() { - Hashtable copyOfTable = Table; // Avoid a race with Dispose + Dictionary copyOfTable = _table; // Avoid a race with Dispose if (copyOfTable == null) throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet); return copyOfTable.GetEnumerator(); @@ -271,13 +227,7 @@ namespace System.Resources while (en.MoveNext()) { Object value = en.Value; -#if LOOSELY_LINKED_RESOURCE_REFERENCE - if (Assembly != null && value is LooselyLinkedResourceReference) { - LooselyLinkedResourceReference assRef = (LooselyLinkedResourceReference) value; - value = assRef.Resolve(Assembly); - } -#endif //LOOSELYLINKEDRESOURCEREFERENCE - Table.Add(en.Key, value); + _table.Add(en.Key, value); } // While technically possible to close the Reader here, don't close it // to help with some WinRes lifetime issues. @@ -286,10 +236,10 @@ namespace System.Resources private Object GetObjectInternal(String name) { if (name == null) - throw new ArgumentNullException(nameof(name)); + throw new ArgumentNullException("name"); Contract.EndContractBlock(); - Hashtable copyOfTable = Table; // Avoid a race with Dispose + Dictionary copyOfTable = _table; // Avoid a race with Dispose if (copyOfTable == null) throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet); @@ -299,19 +249,15 @@ namespace System.Resources private Object GetCaseInsensitiveObjectInternal(String name) { - Hashtable copyOfTable = Table; // Avoid a race with Dispose + Dictionary copyOfTable = _table; // Avoid a race with Dispose if (copyOfTable == null) throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet); - Hashtable caseTable = _caseInsensitiveTable; // Avoid a race condition with Close + Dictionary caseTable = _caseInsensitiveTable; // Avoid a race condition with Close if (caseTable == null) { - caseTable = new Hashtable(StringComparer.OrdinalIgnoreCase); -#if _DEBUG - //Console.WriteLine("ResourceSet::GetObject loading up case-insensitive data"); - BCLDebug.Perf(false, "Using case-insensitive lookups is bad perf-wise. Consider capitalizing " + name + " correctly in your source"); -#endif + caseTable = new Dictionary(CaseInsensitiveStringObjectComparer.Instance); IDictionaryEnumerator en = copyOfTable.GetEnumerator(); while (en.MoveNext()) @@ -323,5 +269,25 @@ namespace System.Resources return caseTable[name]; } + + /// + /// Adapter for StringComparer.OrdinalIgnoreCase to allow it to be used with Dictionary + /// + private class CaseInsensitiveStringObjectComparer : IEqualityComparer + { + public static CaseInsensitiveStringObjectComparer Instance { get; } = new CaseInsensitiveStringObjectComparer(); + + private CaseInsensitiveStringObjectComparer() { } + + public new bool Equals(object x, object y) + { + return ((IEqualityComparer)StringComparer.OrdinalIgnoreCase).Equals(x, y); + } + + public int GetHashCode(object obj) + { + return ((IEqualityComparer)StringComparer.OrdinalIgnoreCase).GetHashCode(obj); + } + } } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs b/src/coreclr/src/mscorlib/shared/System/Resources/RuntimeResourceSet.cs similarity index 91% rename from src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/RuntimeResourceSet.cs index e9c038a..a214050 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/RuntimeResourceSet.cs @@ -13,18 +13,18 @@ ** ===========================================================*/ +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Reflection; +using System.Runtime.Versioning; +using System.Diagnostics; +using System.Diagnostics.Contracts; + namespace System.Resources { - using System; - using System.IO; - using System.Collections; - using System.Collections.Generic; - using System.Globalization; - using System.Reflection; - using System.Runtime.Versioning; - using System.Diagnostics; - using System.Diagnostics.Contracts; - // A RuntimeResourceSet stores all the resources defined in one // particular CultureInfo, with some loading optimizations. // @@ -189,31 +189,18 @@ namespace System.Resources internal RuntimeResourceSet(String fileName) : base(false) { - BCLDebug.Log("RESMGRFILEFORMAT", "RuntimeResourceSet .ctor(String)"); _resCache = new Dictionary(FastResourceComparer.Default); Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); _defaultReader = new ResourceReader(stream, _resCache); Reader = _defaultReader; } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - internal RuntimeResourceSet(Stream stream, Assembly assembly) : base(false) - { - BCLDebug.Log("RESMGRFILEFORMAT", "RuntimeResourceSet .ctor(Stream)"); - _resCache = new Dictionary(FastResourceComparer.Default); - _defaultReader = new ResourceReader(stream, _resCache); - Reader = _defaultReader; - Assembly = assembly; - } -#else internal RuntimeResourceSet(Stream stream) : base(false) { - BCLDebug.Log("RESMGRFILEFORMAT", "RuntimeResourceSet .ctor(Stream)"); _resCache = new Dictionary(FastResourceComparer.Default); _defaultReader = new ResourceReader(stream, _resCache); Reader = _defaultReader; } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE protected override void Dispose(bool disposing) { @@ -305,8 +292,6 @@ namespace System.Resources if (_defaultReader != null) { - BCLDebug.Log("RESMGRFILEFORMAT", "Going down fast path in RuntimeResourceSet::GetObject"); - // Find the offset within the data section int dataPos = -1; if (_resCache.TryGetValue(key, out resLocation)) @@ -348,13 +333,6 @@ namespace System.Resources if (value != null || !ignoreCase) { -#if LOOSELY_LINKED_RESOURCE_REFERENCE - if (Assembly != null && (value is LooselyLinkedResourceReference)) { - LooselyLinkedResourceReference assRef = (LooselyLinkedResourceReference) value; - value = assRef.Resolve(Assembly); - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE - return value; // may be null } } // if (_defaultReader != null) @@ -369,9 +347,6 @@ namespace System.Resources { _caseInsensitiveTable = new Dictionary(StringComparer.OrdinalIgnoreCase); } -#if _DEBUG - BCLDebug.Perf(!ignoreCase, "Using case-insensitive lookups is bad perf-wise. Consider capitalizing " + key + " correctly in your source"); -#endif if (_defaultReader == null) { @@ -450,13 +425,7 @@ namespace System.Resources copyOfCache[key] = resLocation; } } -#if LOOSELY_LINKED_RESOURCE_REFERENCE - if (Assembly != null && value is LooselyLinkedResourceReference) { - LooselyLinkedResourceReference assRef = (LooselyLinkedResourceReference) value; - value = assRef.Resolve(Assembly); - } -#endif // LOOSELY_LINKED_RESOURCE_REFERENCE return value; } } -} +} \ No newline at end of file diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs deleted file mode 100644 index 8a7f591..0000000 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// -// Abstract derivations of SafeHandle designed to provide the common -// functionality supporting Win32 handles. More specifically, they describe how -// an invalid handle looks (for instance, some handles use -1 as an invalid -// handle value, others use 0). -// -// Further derivations of these classes can specialise this even further (e.g. -// file or registry handles). -// -// - -using System; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Runtime.ConstrainedExecution; - -namespace Microsoft.Win32.SafeHandles -{ - // Class of safe handle which uses 0 or -1 as an invalid handle. - public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle - { - protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle) - { - } - - // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime - protected SafeHandleZeroOrMinusOneIsInvalid() - { - throw new NotImplementedException(); - } - - public override bool IsInvalid - { - get { return handle.IsNull() || handle == new IntPtr(-1); } - } - } - - // Class of safe handle which uses only -1 as an invalid handle. - public abstract class SafeHandleMinusOneIsInvalid : SafeHandle - { - protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle) - { - } - - // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime - protected SafeHandleMinusOneIsInvalid() - { - throw new NotImplementedException(); - } - - public override bool IsInvalid - { - get { return handle == new IntPtr(-1); } - } - } -}