From b61cf3fbc7ea4ab951900db419ab9da8188509bd Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Fri, 9 Dec 2016 21:11:20 -0800 Subject: [PATCH] Removes final FEATURE_CORECLR defines (dotnet/coreclr#8555) Commit migrated from https://github.com/dotnet/coreclr/commit/e2d70ff4c0a30c947d572c0604f7cd1a44f258b7 --- .../src/mscorlib/Common/PinnableBufferCache.cs | 77 -- .../System/IO/FileStreamCompletionSource.Win32.cs | 2 +- .../src/mscorlib/mscorlib.shared.sources.props | 1 - .../src/Internal/Runtime/Augments/RuntimeThread.cs | 3 - .../mscorlib/src/Microsoft/Win32/RegistryKey.cs | 14 - .../Win32/SafeHandles/SafeLibraryHandle.cs | 9 - .../Win32/SafeHandles/SafeLocalAllocHandle.cs | 4 +- .../mscorlib/src/Microsoft/Win32/Win32Native.cs | 13 +- .../src/mscorlib/src/System.Private.CoreLib.txt | 959 --------------------- .../System/AppContext/AppContextDefaultValues.cs | 6 - src/coreclr/src/mscorlib/src/System/CfgParser.cs | 8 - .../mscorlib/src/System/Collections/ArrayList.cs | 4 - .../src/System/Collections/Generic/Dictionary.cs | 18 +- .../System/Collections/Generic/EqualityComparer.cs | 2 - .../mscorlib/src/System/Collections/SortedList.cs | 4 +- .../src/mscorlib/src/System/CurrentTimeZone.cs | 2 - src/coreclr/src/mscorlib/src/System/DateTime.cs | 12 - .../src/mscorlib/src/System/Diagnostics/Assert.cs | 16 - .../src/System/Diagnostics/Eventing/EventSource.cs | 4 - .../mscorlib/src/System/Diagnostics/Stacktrace.cs | 16 +- src/coreclr/src/mscorlib/src/System/Exception.cs | 8 - .../src/System/Globalization/CultureData.cs | 2 - .../src/System/Globalization/CultureInfo.cs | 5 +- .../src/System/Globalization/DateTimeFormat.cs | 13 +- .../src/System/Globalization/DateTimeFormatInfo.cs | 19 +- .../src/System/Globalization/DateTimeParse.cs | 4 +- .../src/System/Globalization/RegionInfo.cs | 9 - .../src/mscorlib/src/System/IO/Directory.cs | 12 +- .../src/mscorlib/src/System/IO/DirectoryInfo.cs | 28 +- src/coreclr/src/mscorlib/src/System/IO/File.cs | 4 - .../mscorlib/src/System/IO/FileSystemEnumerable.cs | 44 +- src/coreclr/src/mscorlib/src/System/IO/Stream.cs | 30 +- .../src/mscorlib/src/System/IO/StreamWriter.cs | 4 - src/coreclr/src/mscorlib/src/System/IntPtr.cs | 4 - src/coreclr/src/mscorlib/src/System/Internal.cs | 11 +- src/coreclr/src/mscorlib/src/System/Lazy.cs | 9 - src/coreclr/src/mscorlib/src/System/Object.cs | 10 +- .../src/mscorlib/src/System/OleAutBinder.cs | 20 - .../src/System/Reflection/ComInterfaces.cs | 491 +---------- .../src/System/Reflection/ConstructorInfo.cs | 92 -- .../src/System/Reflection/CustomAttribute.cs | 9 - .../src/System/Reflection/Emit/AssemblyBuilder.cs | 380 +------- .../Reflection/Emit/AssemblyBuilderAccess.cs | 6 +- .../System/Reflection/Emit/AssemblyBuilderData.cs | 36 +- .../src/System/Reflection/Emit/ComInterfaces.cs | 173 +--- .../System/Reflection/Emit/ConstructorBuilder.cs | 22 - .../Reflection/Emit/CustomAttributeBuilder.cs | 22 - .../src/System/Reflection/Emit/DynamicMethod.cs | 162 ---- .../src/System/Reflection/Emit/EnumBuilder.cs | 23 - .../src/System/Reflection/Emit/EventBuilder.cs | 27 - .../src/System/Reflection/Emit/FieldBuilder.cs | 22 - .../src/System/Reflection/Emit/ILGenerator.cs | 22 - .../src/System/Reflection/Emit/ISymWrapperCore.cs | 11 - .../src/System/Reflection/Emit/LocalBuilder.cs | 22 - .../src/System/Reflection/Emit/MethodBuilder.cs | 37 +- .../src/System/Reflection/Emit/ModuleBuilder.cs | 268 ------ .../mscorlib/src/System/Reflection/Emit/Opcode.cs | 118 --- .../src/System/Reflection/Emit/ParameterBuilder.cs | 22 - .../src/System/Reflection/Emit/PropertyBuilder.cs | 23 - .../src/System/Reflection/Emit/SignatureHelper.cs | 22 - .../src/System/Reflection/Emit/TypeBuilder.cs | 74 -- .../mscorlib/src/System/Reflection/EventInfo.cs | 29 - .../mscorlib/src/System/Reflection/FieldInfo.cs | 29 - .../mscorlib/src/System/Reflection/MemberInfo.cs | 28 - .../mscorlib/src/System/Reflection/MethodBase.cs | 42 - .../mscorlib/src/System/Reflection/MethodInfo.cs | 57 -- .../src/System/Reflection/ParameterInfo.cs | 22 - .../mscorlib/src/System/Reflection/PropertyInfo.cs | 29 - .../src/System/Reflection/StrongNameKeyPair.cs | 83 -- .../System/Resources/FileBasedResourceGroveler.cs | 18 - .../src/System/Resources/IResourceGroveler.cs | 5 - .../Resources/ManifestBasedResourceGroveler.cs | 120 +-- .../System/Resources/ResourceFallbackManager.cs | 13 - .../src/System/Resources/ResourceManager.cs | 134 +-- .../mscorlib/src/System/Resources/ResourceSet.cs | 10 +- src/coreclr/src/mscorlib/src/System/RtType.cs | 77 -- .../Runtime/CompilerServices/RuntimeHelpers.cs | 63 -- .../Runtime/InteropServices/CriticalHandle.cs | 4 - .../System/Runtime/InteropServices/IException.cs | 41 +- .../src/System/Runtime/InteropServices/Marshal.cs | 267 +----- .../Runtime/InteropServices/RuntimeEnvironment.cs | 46 +- .../System/Runtime/InteropServices/SafeHandle.cs | 4 - .../Runtime/InteropServices/TypeLibConverter.cs | 595 ------------- .../WindowsRuntime/IRestrictedErrorInfo.cs | 2 - .../Runtime/Reliability/CriticalFinalizerObject.cs | 2 - .../Runtime/Serialization/SerializationInfo.cs | 13 +- .../src/mscorlib/src/System/RuntimeHandles.cs | 19 - .../src/System/Security/CodeAccessPermission.cs | 2 - .../System/Security/CodeAccessSecurityEngine.cs | 28 +- .../src/System/Security/HostSecurityManager.cs | 2 - .../Permissions/HostProtectionPermission.cs | 2 - .../Security/Principal/TokenImpersonationLevel.cs | 9 +- .../src/System/Security/SecurityElement.cs | 14 +- .../mscorlib/src/System/Security/SecurityState.cs | 5 +- .../src/mscorlib/src/System/String.Manipulation.cs | 20 +- src/coreclr/src/mscorlib/src/System/String.cs | 12 +- src/coreclr/src/mscorlib/src/System/StubHelpers.cs | 63 -- .../src/System/Threading/LockRecursionException.cs | 3 - .../src/mscorlib/src/System/Threading/Mutex.cs | 14 +- .../mscorlib/src/System/Threading/Overlapped.cs | 3 - .../src/System/Threading/SemaphoreFullException.cs | 3 - .../src/mscorlib/src/System/Threading/SpinLock.cs | 60 -- .../src/mscorlib/src/System/Threading/SpinWait.cs | 4 - .../src/System/Threading/SynchronizationContext.cs | 47 - .../mscorlib/src/System/Threading/Tasks/Task.cs | 55 -- .../System/Threading/Tasks/TaskExceptionHolder.cs | 6 +- .../src/mscorlib/src/System/Threading/Thread.cs | 326 +------ .../mscorlib/src/System/Threading/WaitHandle.cs | 24 +- src/coreclr/src/mscorlib/src/System/ThrowHelper.cs | 3 - src/coreclr/src/mscorlib/src/System/TimeSpan.cs | 18 +- src/coreclr/src/mscorlib/src/System/TimeZone.cs | 4 +- .../src/mscorlib/src/System/TimeZoneInfo.cs | 13 - .../src/System/TimeZoneNotFoundException.cs | 3 - src/coreclr/src/mscorlib/src/System/Type.cs | 30 +- src/coreclr/src/mscorlib/src/System/UIntPtr.cs | 4 - .../src/mscorlib/src/System/WeakReference.cs | 7 +- src/coreclr/src/mscorlib/src/mscorlib.Friends.cs | 2 - 117 files changed, 123 insertions(+), 5909 deletions(-) delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs diff --git a/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs b/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs index ead3380..fc6e13a 100644 --- a/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs +++ b/src/coreclr/src/mscorlib/Common/PinnableBufferCache.cs @@ -531,8 +531,6 @@ namespace System #endregion } - -#if FEATURE_CORECLR internal sealed class PinnableBufferCacheEventSource { public static readonly PinnableBufferCacheEventSource Log = new PinnableBufferCacheEventSource(); @@ -568,79 +566,4 @@ namespace System return 0; } } -#else - /// - /// PinnableBufferCacheEventSource is a private eventSource that we are using to - /// debug and monitor the effectiveness of PinnableBufferCache - /// -#if PINNABLEBUFFERCACHE_MSCORLIB - [EventSource(Name = "Microsoft-DotNETRuntime-PinnableBufferCache")] -#else - [EventSource(Name = "Microsoft-DotNETRuntime-PinnableBufferCache-System")] -#endif - internal sealed class PinnableBufferCacheEventSource : EventSource - { - public static readonly PinnableBufferCacheEventSource Log = new PinnableBufferCacheEventSource(); - - [Event(1, Level = EventLevel.Verbose)] - public void DebugMessage(string message) { if (IsEnabled()) WriteEvent(1, message); } - [Event(2, Level = EventLevel.Verbose)] - public void DebugMessage1(string message, long value) { if (IsEnabled()) WriteEvent(2, message, value); } - [Event(3, Level = EventLevel.Verbose)] - public void DebugMessage2(string message, long value1, long value2) { if (IsEnabled()) WriteEvent(3, message, value1, value2); } - [Event(18, Level = EventLevel.Verbose)] - public void DebugMessage3(string message, long value1, long value2, long value3) { if (IsEnabled()) WriteEvent(18, message, value1, value2, value3); } - - [Event(4)] - public void Create(string cacheName) { if (IsEnabled()) WriteEvent(4, cacheName); } - - [Event(5, Level = EventLevel.Verbose)] - public void AllocateBuffer(string cacheName, ulong objectId, int objectHash, int objectGen, int freeCountAfter) { if (IsEnabled()) WriteEvent(5, cacheName, objectId, objectHash, objectGen, freeCountAfter); } - [Event(6)] - public void AllocateBufferFromNotGen2(string cacheName, int notGen2CountAfter) { if (IsEnabled()) WriteEvent(6, cacheName, notGen2CountAfter); } - [Event(7)] - public void AllocateBufferCreatingNewBuffers(string cacheName, int totalBuffsBefore, int objectCount) { if (IsEnabled()) WriteEvent(7, cacheName, totalBuffsBefore, objectCount); } - [Event(8)] - public void AllocateBufferAged(string cacheName, int agedCount) { if (IsEnabled()) WriteEvent(8, cacheName, agedCount); } - [Event(9)] - public void AllocateBufferFreeListEmpty(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(9, cacheName, notGen2CountBefore); } - - [Event(10, Level = EventLevel.Verbose)] - public void FreeBuffer(string cacheName, ulong objectId, int objectHash, int freeCountBefore) { if (IsEnabled()) WriteEvent(10, cacheName, objectId, objectHash, freeCountBefore); } - [Event(11)] - public void FreeBufferStillTooYoung(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(11, cacheName, notGen2CountBefore); } - - [Event(13)] - public void TrimCheck(string cacheName, int totalBuffs, bool neededMoreThanFreeList, int deltaMSec) { if (IsEnabled()) WriteEvent(13, cacheName, totalBuffs, neededMoreThanFreeList, deltaMSec); } - [Event(14)] - public void TrimFree(string cacheName, int totalBuffs, int freeListCount, int toBeFreed) { if (IsEnabled()) WriteEvent(14, cacheName, totalBuffs, freeListCount, toBeFreed); } - [Event(15)] - public void TrimExperiment(string cacheName, int totalBuffs, int freeListCount, int numTrimTrial) { if (IsEnabled()) WriteEvent(15, cacheName, totalBuffs, freeListCount, numTrimTrial); } - [Event(16)] - public void TrimFreeSizeOK(string cacheName, int totalBuffs, int freeListCount) { if (IsEnabled()) WriteEvent(16, cacheName, totalBuffs, freeListCount); } - [Event(17)] - public void TrimFlush(string cacheName, int totalBuffs, int freeListCount, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(17, cacheName, totalBuffs, freeListCount, notGen2CountBefore); } - [Event(20)] - public void AgePendingBuffersResults(string cacheName, int promotedToFreeListCount, int heldBackCount) { if (IsEnabled()) WriteEvent(20, cacheName, promotedToFreeListCount, heldBackCount); } - [Event(21)] - public void WalkFreeListResult(string cacheName, int freeListCount, int gen0BuffersInFreeList) { if (IsEnabled()) WriteEvent(21, cacheName, freeListCount, gen0BuffersInFreeList); } - - - static internal ulong AddressOf(object obj) - { - var asByteArray = obj as byte[]; - if (asByteArray != null) - return (ulong)AddressOfByteArray(asByteArray); - return 0; - } - - static internal unsafe long AddressOfByteArray(byte[] array) - { - if (array == null) - return 0; - fixed (byte* ptr = array) - return (long)(ptr - 2 * sizeof(void*)); - } - } -#endif } diff --git a/src/coreclr/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs b/src/coreclr/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs index 6f8efb8..532dbb0 100644 --- a/src/coreclr/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs +++ b/src/coreclr/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs @@ -58,7 +58,7 @@ namespace System.IO internal NativeOverlapped* Overlapped { - [SecurityCritical]get { return _overlapped; } + get { return _overlapped; } } public void SetCompletedSynchronously(int numBytes) diff --git a/src/coreclr/src/mscorlib/mscorlib.shared.sources.props b/src/coreclr/src/mscorlib/mscorlib.shared.sources.props index 8d4142e..16dfd56 100644 --- a/src/coreclr/src/mscorlib/mscorlib.shared.sources.props +++ b/src/coreclr/src/mscorlib/mscorlib.shared.sources.props @@ -133,7 +133,6 @@ - diff --git a/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs index a8ed8db..89fc670 100644 --- a/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs +++ b/src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs @@ -165,9 +165,6 @@ namespace Internal.Runtime.Augments ** thread is not currently blocked in that manner, it will be interrupted ** when it next begins to block. =========================================================================*/ -#if FEATURE_CORECLR -#else -#endif #pragma warning disable 618 // obsolete types: SecurityPermissionAttribute, SecurityAction #pragma warning restore 618 // obsolete types: SecurityPermissionAttribute, SecurityAction public void Interrupt() => InterruptInternal(); diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs index d38798a..ff678f1 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs @@ -623,9 +623,6 @@ namespace Microsoft.Win32 * * @return the Subkey requested, or null if the operation failed. */ - #if FEATURE_CORECLR - #else - #endif public RegistryKey OpenSubKey(string name, bool writable ) { ValidateKeyName(name); EnsureNotDisposed(); @@ -684,8 +681,6 @@ namespace Microsoft.Win32 * * @return the Subkey requested, or null if the operation failed. */ -#if FEATURE_CORECLR -#endif public RegistryKey OpenSubKey(String name) { return OpenSubKey(name, false); } @@ -738,9 +733,6 @@ namespace Microsoft.Win32 * * @return all subkey names. */ - #if FEATURE_CORECLR - #else - #endif public String[] GetSubKeyNames() { CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default); return InternalGetSubKeyNames(); @@ -886,17 +878,11 @@ namespace Microsoft.Win32 * * @return the data associated with the value. */ - #if FEATURE_CORECLR - #else - #endif public Object GetValue(String name, Object defaultValue) { CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default); return InternalGetValue(name, defaultValue, false, true); } - #if FEATURE_CORECLR - #else - #endif [ComVisible(false)] public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) { if( options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) { diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs index c4d53e2..058247e 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs @@ -3,17 +3,8 @@ // See the LICENSE file in the project root for more information. namespace Microsoft.Win32 { - using Microsoft.Win32; using Microsoft.Win32.SafeHandles; - using System; - using System.Runtime.CompilerServices; - using System.Runtime.ConstrainedExecution; - using System.Runtime.InteropServices; - using System.Runtime.Serialization; - using System.Runtime.Versioning; - using System.Security; using System.Security.Permissions; - using System.Text; [HostProtectionAttribute(MayLeakOnAbort = true)] sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs index 8c324b8..d6c1577 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs @@ -1,7 +1,9 @@ // 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. -namespace Microsoft.Win32.SafeHandles { + +namespace Microsoft.Win32.SafeHandles +{ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs index e876681..b5b808b 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs @@ -1737,18 +1737,11 @@ namespace Microsoft.Win32 { [In] uint dwFlags); #endif // FEATURE_LEGACYSURFACE -#if FEATURE_CORECLR [DllImport(NTDLL, CharSet=CharSet.Unicode, SetLastError=true)] internal static extern int RtlNtStatusToDosError ( [In] int status); -#else - // identical to RtlNtStatusToDosError, but we are in ask mode for desktop CLR - [DllImport(ADVAPI32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern - int LsaNtStatusToWinError ( - [In] int status); -#endif + // Get the current FIPS policy setting on Vista and above [DllImport("bcrypt.dll")] internal static extern uint BCryptGetFipsAlgorithmMode( @@ -2295,7 +2288,6 @@ namespace Microsoft.Win32 { byte[] dacl, byte[] sacl ); -#if FEATURE_CORECLR [DllImport(KERNEL32, CharSet=CharSet.Unicode)] [SuppressUnmanagedCodeSecurityAttribute()] internal unsafe static extern int WideCharToMultiByte( @@ -2317,13 +2309,11 @@ namespace Microsoft.Win32 { int cchMultiByte, char* lpWideCharStr, int cchWideChar); -#endif // FEATURE_CORECLR [DllImport(KERNEL32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal extern static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime); -#if FEATURE_CORECLR #if FEATURE_PAL [DllImport(KERNEL32, EntryPoint = "PAL_Random")] internal extern static bool Random(bool bStrong, @@ -2350,6 +2340,5 @@ namespace Microsoft.Win32 { } } #endif -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt b/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt index c379612..ee1a962 100644 --- a/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt +++ b/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt @@ -49,10 +49,6 @@ ArgumentOutOfRange_ActualValue = Actual value was {0}. NoDebugResources = [{0}]\r\nArguments: {1}\r\nDebugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version={2}&File={3}&Key={4} #endif // INCLUDE_RUNTIME -#if !FEATURE_CORECLR -UnknownError = Unknown error. -#endif // !FEATURE_CORECLR - #if INCLUDE_DEBUG ; For code contracts @@ -102,9 +98,7 @@ Access_Void = Cannot create an instance of void. Arg_TypedReference_Null = The TypedReference must be initialized. Argument_AddingDuplicate__ = Item has already been added. Key in dictionary: '{0}' Key being added: '{1}' Argument_AddingDuplicate = An item with the same key has already been added. -#if FEATURE_CORECLR Argument_AddingDuplicateWithKey = An item with the same key has already been added. Key: {0} -#endif // FEATURE_CORECLR Argument_MethodDeclaringTypeGenericLcg = Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor. Argument_MethodDeclaringTypeGeneric = Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle. Argument_FieldDeclaringTypeGeneric = Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle. @@ -1628,10 +1622,8 @@ IO.PathNotFound_NoPathName = Could not find a part of the path. ; PathTooLongException IO.PathTooLong = The specified file name or path is too long, or a component of the specified path is too long. -#if FEATURE_CORECLR ; SecurityException FileSecurityState_OperationNotPermitted = File operation not permitted. Access to path '{0}' is denied. -#endif ; PrivilegeNotHeldException PrivilegeNotHeld_Default = The process does not possess some privilege required for this operation. @@ -2124,957 +2116,6 @@ InvalidOperation_CannotRemoveLastFromEmptyCollection=Cannot remove the last elem ; Buffers ArgumentException_BufferNotFromPool=The buffer is not associated with this pool and may not be returned to it. -; Globalization resources -;------------------ - -#if !FEATURE_CORECLR -Globalization.LegacyModifier = Legacy - -; -;Total items: 809 -; -Globalization.ci_ = Invariant Language (Invariant Country) -Globalization.ci_aa = Afar -Globalization.ci_aa-DJ = Afar (Djibouti) -Globalization.ci_aa-ER = Afar (Eritrea) -Globalization.ci_aa-ET = Afar (Ethiopia) -Globalization.ci_af = Afrikaans -Globalization.ci_af-NA = Afrikaans (Namibia) -Globalization.ci_af-ZA = Afrikaans (South Africa) -Globalization.ci_agq = Aghem -Globalization.ci_agq-CM = Aghem (Cameroon) -Globalization.ci_ak = Akan -Globalization.ci_ak-GH = Akan (Ghana) -Globalization.ci_am = Amharic -Globalization.ci_am-ET = Amharic (Ethiopia) -Globalization.ci_ar = Arabic -Globalization.ci_ar-001 = Arabic (World) -Globalization.ci_ar-AE = Arabic (U.A.E.) -Globalization.ci_ar-BH = Arabic (Bahrain) -Globalization.ci_ar-DJ = Arabic (Djibouti) -Globalization.ci_ar-DZ = Arabic (Algeria) -Globalization.ci_ar-EG = Arabic (Egypt) -Globalization.ci_ar-ER = Arabic (Eritrea) -Globalization.ci_ar-IL = Arabic (Israel) -Globalization.ci_ar-IQ = Arabic (Iraq) -Globalization.ci_ar-JO = Arabic (Jordan) -Globalization.ci_ar-KM = Arabic (Comoros) -Globalization.ci_ar-KW = Arabic (Kuwait) -Globalization.ci_ar-LB = Arabic (Lebanon) -Globalization.ci_ar-LY = Arabic (Libya) -Globalization.ci_ar-MA = Arabic (Morocco) -Globalization.ci_ar-MR = Arabic (Mauritania) -Globalization.ci_ar-OM = Arabic (Oman) -Globalization.ci_ar-PS = Arabic (Palestinian Authority) -Globalization.ci_ar-QA = Arabic (Qatar) -Globalization.ci_ar-SA = Arabic (Saudi Arabia) -Globalization.ci_ar-SD = Arabic (Sudan) -Globalization.ci_ar-SO = Arabic (Somalia) -Globalization.ci_ar-SS = Arabic (South Sudan) -Globalization.ci_ar-SY = Arabic (Syria) -Globalization.ci_ar-TD = Arabic (Chad) -Globalization.ci_ar-TN = Arabic (Tunisia) -Globalization.ci_ar-YE = Arabic (Yemen) -Globalization.ci_arn = Mapudungun -Globalization.ci_arn-CL = Mapudungun (Chile) -Globalization.ci_as = Assamese -Globalization.ci_as-IN = Assamese (India) -Globalization.ci_asa = Asu -Globalization.ci_asa-TZ = Asu (Tanzania) -Globalization.ci_ast = Asturian -Globalization.ci_ast-ES = Asturian (Spain) -Globalization.ci_az = Azerbaijani -Globalization.ci_az-Cyrl = Azerbaijani (Cyrillic) -Globalization.ci_az-Cyrl-AZ = Azerbaijani (Cyrillic, Azerbaijan) -Globalization.ci_az-Latn = Azerbaijani (Latin) -Globalization.ci_az-Latn-AZ = Azerbaijani (Latin, Azerbaijan) -Globalization.ci_ba = Bashkir -Globalization.ci_ba-RU = Bashkir (Russia) -Globalization.ci_bas = Basaa -Globalization.ci_bas-CM = Basaa (Cameroon) -Globalization.ci_be = Belarusian -Globalization.ci_be-BY = Belarusian (Belarus) -Globalization.ci_bem = Bemba -Globalization.ci_bem-ZM = Bemba (Zambia) -Globalization.ci_bez = Bena -Globalization.ci_bez-TZ = Bena (Tanzania) -Globalization.ci_bg = Bulgarian -Globalization.ci_bg-BG = Bulgarian (Bulgaria) -Globalization.ci_bm = Bambara -Globalization.ci_bm-Latn = Bambara (Latin) -Globalization.ci_bm-Latn-ML = Bambara (Latin, Mali) -Globalization.ci_bm-ML = Bamanankan (Latin, Mali) -Globalization.ci_bn = Bangla -Globalization.ci_bn-BD = Bangla (Bangladesh) -Globalization.ci_bn-IN = Bangla (India) -Globalization.ci_bo = Tibetan -Globalization.ci_bo-CN = Tibetan (PRC) -Globalization.ci_bo-IN = Tibetan (India) -Globalization.ci_br = Breton -Globalization.ci_br-FR = Breton (France) -Globalization.ci_brx = Bodo -Globalization.ci_brx-IN = Bodo (India) -Globalization.ci_bs = Bosnian -Globalization.ci_bs-Cyrl = Bosnian (Cyrillic) -Globalization.ci_bs-Cyrl-BA = Bosnian (Cyrillic, Bosnia and Herzegovina) -Globalization.ci_bs-Latn = Bosnian (Latin) -Globalization.ci_bs-Latn-BA = Bosnian (Latin, Bosnia and Herzegovina) -Globalization.ci_byn = Blin -Globalization.ci_byn-ER = Blin (Eritrea) -Globalization.ci_ca = Catalan -Globalization.ci_ca-AD = Catalan (Andorra) -Globalization.ci_ca-ES = Catalan (Catalan) -Globalization.ci_ca-ES-valencia = Valencian (Spain) -Globalization.ci_ca-FR = Catalan (France) -Globalization.ci_ca-IT = Catalan (Italy) -Globalization.ci_cgg = Chiga -Globalization.ci_cgg-UG = Chiga (Uganda) -Globalization.ci_chr = Cherokee -Globalization.ci_chr-Cher = Cherokee (Cherokee) -Globalization.ci_chr-Cher-US = Cherokee (Cherokee) -Globalization.ci_co = Corsican -Globalization.ci_co-FR = Corsican (France) -Globalization.ci_cs = Czech -Globalization.ci_cs-CZ = Czech (Czech Republic) -Globalization.ci_cy = Welsh -Globalization.ci_cy-GB = Welsh (United Kingdom) -Globalization.ci_da = Danish -Globalization.ci_da-DK = Danish (Denmark) -Globalization.ci_da-GL = Danish (Greenland) -Globalization.ci_dav = Taita -Globalization.ci_dav-KE = Taita (Kenya) -Globalization.ci_de = German -Globalization.ci_de-AT = German (Austria) -Globalization.ci_de-BE = German (Belgium) -Globalization.ci_de-CH = German (Switzerland) -Globalization.ci_de-DE = German (Germany) -Globalization.ci_de-DE_phoneb = German (Germany) -Globalization.ci_de-LI = German (Liechtenstein) -Globalization.ci_de-LU = German (Luxembourg) -Globalization.ci_dje = Zarma -Globalization.ci_dje-NE = Zarma (Niger) -Globalization.ci_dsb = Lower Sorbian -Globalization.ci_dsb-DE = Lower Sorbian (Germany) -Globalization.ci_dua = Duala -Globalization.ci_dua-CM = Duala (Cameroon) -Globalization.ci_dv = Divehi -Globalization.ci_dv-MV = Divehi (Maldives) -Globalization.ci_dyo = Jola-Fonyi -Globalization.ci_dyo-SN = Jola-Fonyi (Senegal) -Globalization.ci_dz = Dzongkha -Globalization.ci_dz-BT = Dzongkha (Bhutan) -Globalization.ci_ebu = Embu -Globalization.ci_ebu-KE = Embu (Kenya) -Globalization.ci_ee = Ewe -Globalization.ci_ee-GH = Ewe (Ghana) -Globalization.ci_ee-TG = Ewe (Togo) -Globalization.ci_el = Greek -Globalization.ci_el-CY = Greek (Cyprus) -Globalization.ci_el-GR = Greek (Greece) -Globalization.ci_en = English -Globalization.ci_en-001 = English (World) -Globalization.ci_en-029 = English (Caribbean) -Globalization.ci_en-150 = English (Europe) -Globalization.ci_en-AG = English (Antigua and Barbuda) -Globalization.ci_en-AI = English (Anguilla) -Globalization.ci_en-AS = English (American Samoa) -Globalization.ci_en-AU = English (Australia) -Globalization.ci_en-BB = English (Barbados) -Globalization.ci_en-BE = English (Belgium) -Globalization.ci_en-BM = English (Bermuda) -Globalization.ci_en-BS = English (Bahamas) -Globalization.ci_en-BW = English (Botswana) -Globalization.ci_en-BZ = English (Belize) -Globalization.ci_en-CA = English (Canada) -Globalization.ci_en-CC = English (Cocos [Keeling] Islands) -Globalization.ci_en-CK = English (Cook Islands) -Globalization.ci_en-CM = English (Cameroon) -Globalization.ci_en-CX = English (Christmas Island) -Globalization.ci_en-DM = English (Dominica) -Globalization.ci_en-ER = English (Eritrea) -Globalization.ci_en-FJ = English (Fiji) -Globalization.ci_en-FK = English (Falkland Islands) -Globalization.ci_en-FM = English (Micronesia) -Globalization.ci_en-GB = English (United Kingdom) -Globalization.ci_en-GD = English (Grenada) -Globalization.ci_en-GG = English (Guernsey) -Globalization.ci_en-GH = English (Ghana) -Globalization.ci_en-GI = English (Gibraltar) -Globalization.ci_en-GM = English (Gambia) -Globalization.ci_en-GU = English (Guam) -Globalization.ci_en-GY = English (Guyana) -Globalization.ci_en-HK = English (Hong Kong SAR) -Globalization.ci_en-IE = English (Ireland) -Globalization.ci_en-IM = English (Isle of Man) -Globalization.ci_en-IN = English (India) -Globalization.ci_en-IO = English (British Indian Ocean Territory) -Globalization.ci_en-JE = English (Jersey) -Globalization.ci_en-JM = English (Jamaica) -Globalization.ci_en-KE = English (Kenya) -Globalization.ci_en-KI = English (Kiribati) -Globalization.ci_en-KN = English (Saint Kitts and Nevis) -Globalization.ci_en-KY = English (Cayman Islands) -Globalization.ci_en-LC = English (Saint Lucia) -Globalization.ci_en-LR = English (Liberia) -Globalization.ci_en-LS = English (Lesotho) -Globalization.ci_en-MG = English (Madagascar) -Globalization.ci_en-MH = English (Marshall Islands) -Globalization.ci_en-MO = English (Macao SAR) -Globalization.ci_en-MP = English (Northern Mariana Islands) -Globalization.ci_en-MS = English (Montserrat) -Globalization.ci_en-MT = English (Malta) -Globalization.ci_en-MU = English (Mauritius) -Globalization.ci_en-MW = English (Malawi) -Globalization.ci_en-MY = English (Malaysia) -Globalization.ci_en-NA = English (Namibia) -Globalization.ci_en-NF = English (Norfolk Island) -Globalization.ci_en-NG = English (Nigeria) -Globalization.ci_en-NR = English (Nauru) -Globalization.ci_en-NU = English (Niue) -Globalization.ci_en-NZ = English (New Zealand) -Globalization.ci_en-PG = English (Papua New Guinea) -Globalization.ci_en-PH = English (Republic of the Philippines) -Globalization.ci_en-PK = English (Pakistan) -Globalization.ci_en-PN = English (Pitcairn Islands) -Globalization.ci_en-PR = English (Puerto Rico) -Globalization.ci_en-PW = English (Palau) -Globalization.ci_en-RW = English (Rwanda) -Globalization.ci_en-SB = English (Solomon Islands) -Globalization.ci_en-SC = English (Seychelles) -Globalization.ci_en-SD = English (Sudan) -Globalization.ci_en-SG = English (Singapore) -Globalization.ci_en-SH = English (St Helena, Ascension, Tristan da Cunha) -Globalization.ci_en-SL = English (Sierra Leone) -Globalization.ci_en-SS = English (South Sudan) -Globalization.ci_en-SX = English (Sint Maarten) -Globalization.ci_en-SZ = English (Swaziland) -Globalization.ci_en-TC = English (Turks and Caicos Islands) -Globalization.ci_en-TK = English (Tokelau) -Globalization.ci_en-TO = English (Tonga) -Globalization.ci_en-TT = English (Trinidad and Tobago) -Globalization.ci_en-TV = English (Tuvalu) -Globalization.ci_en-TZ = English (Tanzania) -Globalization.ci_en-UG = English (Uganda) -Globalization.ci_en-UM = English (US Minor Outlying Islands) -Globalization.ci_en-US = English (United States) -Globalization.ci_en-VC = English (Saint Vincent and the Grenadines) -Globalization.ci_en-VG = English (British Virgin Islands) -Globalization.ci_en-VI = English (US Virgin Islands) -Globalization.ci_en-VU = English (Vanuatu) -Globalization.ci_en-WS = English (Samoa) -Globalization.ci_en-ZA = English (South Africa) -Globalization.ci_en-ZM = English (Zambia) -Globalization.ci_en-ZW = English (Zimbabwe) -Globalization.ci_eo = Esperanto -Globalization.ci_eo-001 = Esperanto (World) -Globalization.ci_es = Spanish -Globalization.ci_es-419 = Spanish (Latin America) -Globalization.ci_es-AR = Spanish (Argentina) -Globalization.ci_es-BO = Spanish (Bolivia) -Globalization.ci_es-CL = Spanish (Chile) -Globalization.ci_es-CO = Spanish (Colombia) -Globalization.ci_es-CR = Spanish (Costa Rica) -Globalization.ci_es-CU = Spanish (Cuba) -Globalization.ci_es-DO = Spanish (Dominican Republic) -Globalization.ci_es-EC = Spanish (Ecuador) -Globalization.ci_es-ES = Spanish (Spain) -Globalization.ci_es-ES_tradnl = Spanish (Spain) -Globalization.ci_es-GQ = Spanish (Equatorial Guinea) -Globalization.ci_es-GT = Spanish (Guatemala) -Globalization.ci_es-HN = Spanish (Honduras) -Globalization.ci_es-MX = Spanish (Mexico) -Globalization.ci_es-NI = Spanish (Nicaragua) -Globalization.ci_es-PA = Spanish (Panama) -Globalization.ci_es-PE = Spanish (Peru) -Globalization.ci_es-PH = Spanish (Philippines) -Globalization.ci_es-PR = Spanish (Puerto Rico) -Globalization.ci_es-PY = Spanish (Paraguay) -Globalization.ci_es-SV = Spanish (El Salvador) -Globalization.ci_es-US = Spanish (United States) -Globalization.ci_es-UY = Spanish (Uruguay) -Globalization.ci_es-VE = Spanish (Bolivarian Republic of Venezuela) -Globalization.ci_et = Estonian -Globalization.ci_et-EE = Estonian (Estonia) -Globalization.ci_eu = Basque -Globalization.ci_eu-ES = Basque (Basque) -Globalization.ci_ewo = Ewondo -Globalization.ci_ewo-CM = Ewondo (Cameroon) -Globalization.ci_fa = Persian -Globalization.ci_fa-AF = Persian (Afghanistan) -Globalization.ci_fa-IR = Persian (Iran) -Globalization.ci_ff = Fulah -Globalization.ci_ff-CM = Fulah (Cameroon) -Globalization.ci_ff-GN = Fulah (Guinea) -Globalization.ci_ff-Latn = Fulah (Latin) -Globalization.ci_ff-Latn-SN = Fulah (Latin, Senegal) -Globalization.ci_ff-MR = Fulah (Mauritania) -Globalization.ci_fi = Finnish -Globalization.ci_fi-FI = Finnish (Finland) -Globalization.ci_fil = Filipino -Globalization.ci_fil-PH = Filipino (Philippines) -Globalization.ci_fo = Faroese -Globalization.ci_fo-FO = Faroese (Faroe Islands) -Globalization.ci_fr = French -Globalization.ci_fr-BE = French (Belgium) -Globalization.ci_fr-BF = French (Burkina Faso) -Globalization.ci_fr-BI = French (Burundi) -Globalization.ci_fr-BJ = French (Benin) -Globalization.ci_fr-BL = French (Saint Barthélemy) -Globalization.ci_fr-CA = French (Canada) -Globalization.ci_fr-CD = French (Congo DRC) -Globalization.ci_fr-CF = French (Central African Republic) -Globalization.ci_fr-CG = French (Congo) -Globalization.ci_fr-CH = French (Switzerland) -Globalization.ci_fr-CI = French (Côte d’Ivoire) -Globalization.ci_fr-CM = French (Cameroon) -Globalization.ci_fr-DJ = French (Djibouti) -Globalization.ci_fr-DZ = French (Algeria) -Globalization.ci_fr-FR = French (France) -Globalization.ci_fr-GA = French (Gabon) -Globalization.ci_fr-GF = French (French Guiana) -Globalization.ci_fr-GN = French (Guinea) -Globalization.ci_fr-GP = French (Guadeloupe) -Globalization.ci_fr-GQ = French (Equatorial Guinea) -Globalization.ci_fr-HT = French (Haiti) -Globalization.ci_fr-KM = French (Comoros) -Globalization.ci_fr-LU = French (Luxembourg) -Globalization.ci_fr-MA = French (Morocco) -Globalization.ci_fr-MC = French (Monaco) -Globalization.ci_fr-MF = French (Saint Martin) -Globalization.ci_fr-MG = French (Madagascar) -Globalization.ci_fr-ML = French (Mali) -Globalization.ci_fr-MQ = French (Martinique) -Globalization.ci_fr-MR = French (Mauritania) -Globalization.ci_fr-MU = French (Mauritius) -Globalization.ci_fr-NC = French (New Caledonia) -Globalization.ci_fr-NE = French (Niger) -Globalization.ci_fr-PF = French (French Polynesia) -Globalization.ci_fr-PM = French (Saint Pierre and Miquelon) -Globalization.ci_fr-RE = French (Reunion) -Globalization.ci_fr-RW = French (Rwanda) -Globalization.ci_fr-SC = French (Seychelles) -Globalization.ci_fr-SN = French (Senegal) -Globalization.ci_fr-SY = French (Syria) -Globalization.ci_fr-TD = French (Chad) -Globalization.ci_fr-TG = French (Togo) -Globalization.ci_fr-TN = French (Tunisia) -Globalization.ci_fr-VU = French (Vanuatu) -Globalization.ci_fr-WF = French (Wallis and Futuna) -Globalization.ci_fr-YT = French (Mayotte) -Globalization.ci_fur = Friulian -Globalization.ci_fur-IT = Friulian (Italy) -Globalization.ci_fy = Frisian -Globalization.ci_fy-NL = Frisian (Netherlands) -Globalization.ci_ga = Irish -Globalization.ci_ga-IE = Irish (Ireland) -Globalization.ci_gd = Scottish Gaelic -Globalization.ci_gd-GB = Scottish Gaelic (United Kingdom) -Globalization.ci_gl = Galician -Globalization.ci_gl-ES = Galician (Galician) -Globalization.ci_gn = Guarani -Globalization.ci_gn-PY = Guarani (Paraguay) -Globalization.ci_gsw = Alsatian -Globalization.ci_gsw-CH = Alsatian (Switzerland) -Globalization.ci_gsw-FR = Alsatian (France) -Globalization.ci_gsw-LI = Alsatian (Liechtenstein) -Globalization.ci_gu = Gujarati -Globalization.ci_gu-IN = Gujarati (India) -Globalization.ci_guz = Gusii -Globalization.ci_guz-KE = Gusii (Kenya) -Globalization.ci_gv = Manx -Globalization.ci_gv-IM = Manx (Isle of Man) -Globalization.ci_ha = Hausa -Globalization.ci_ha-Latn = Hausa (Latin) -Globalization.ci_ha-Latn-GH = Hausa (Latin, Ghana) -Globalization.ci_ha-Latn-NE = Hausa (Latin, Niger) -Globalization.ci_ha-Latn-NG = Hausa (Latin, Nigeria) -Globalization.ci_haw = Hawaiian -Globalization.ci_haw-US = Hawaiian (United States) -Globalization.ci_he = Hebrew -Globalization.ci_he-IL = Hebrew (Israel) -Globalization.ci_hi = Hindi -Globalization.ci_hi-IN = Hindi (India) -Globalization.ci_hr = Croatian -Globalization.ci_hr-BA = Croatian (Latin, Bosnia and Herzegovina) -Globalization.ci_hr-HR = Croatian (Croatia) -Globalization.ci_hsb = Upper Sorbian -Globalization.ci_hsb-DE = Upper Sorbian (Germany) -Globalization.ci_hu = Hungarian -Globalization.ci_hu-HU = Hungarian (Hungary) -Globalization.ci_hu-HU_technl = Hungarian (Hungary) -Globalization.ci_hy = Armenian -Globalization.ci_hy-AM = Armenian (Armenia) -Globalization.ci_ia = Interlingua -Globalization.ci_ia-001 = Interlingua (World) -Globalization.ci_ia-FR = Interlingua (France) -Globalization.ci_id = Indonesian -Globalization.ci_id-ID = Indonesian (Indonesia) -Globalization.ci_ig = Igbo -Globalization.ci_ig-NG = Igbo (Nigeria) -Globalization.ci_ii = Yi -Globalization.ci_ii-CN = Yi (PRC) -Globalization.ci_is = Icelandic -Globalization.ci_is-IS = Icelandic (Iceland) -Globalization.ci_it = Italian -Globalization.ci_it-CH = Italian (Switzerland) -Globalization.ci_it-IT = Italian (Italy) -Globalization.ci_it-SM = Italian (San Marino) -Globalization.ci_iu = Inuktitut -Globalization.ci_iu-Cans = Inuktitut (Syllabics) -Globalization.ci_iu-Cans-CA = Inuktitut (Syllabics, Canada) -Globalization.ci_iu-Latn = Inuktitut (Latin) -Globalization.ci_iu-Latn-CA = Inuktitut (Latin, Canada) -Globalization.ci_ja = Japanese -Globalization.ci_ja-JP = Japanese (Japan) -Globalization.ci_ja-JP_radstr = Japanese (Japan) -Globalization.ci_jgo = Ngomba -Globalization.ci_jgo-CM = Ngomba (Cameroon) -Globalization.ci_jmc = Machame -Globalization.ci_jmc-TZ = Machame (Tanzania) -Globalization.ci_jv = Javanese -Globalization.ci_jv-Latn = Javanese -Globalization.ci_jv-Latn-ID = Javanese (Indonesia) -Globalization.ci_ka = Georgian -Globalization.ci_ka-GE = Georgian (Georgia) -Globalization.ci_ka-GE_modern = Georgian (Georgia) -Globalization.ci_kab = Kabyle -Globalization.ci_kab-DZ = Kabyle (Algeria) -Globalization.ci_kam = Kamba -Globalization.ci_kam-KE = Kamba (Kenya) -Globalization.ci_kde = Makonde -Globalization.ci_kde-TZ = Makonde (Tanzania) -Globalization.ci_kea = Kabuverdianu -Globalization.ci_kea-CV = Kabuverdianu (Cabo Verde) -Globalization.ci_khq = Koyra Chiini -Globalization.ci_khq-ML = Koyra Chiini (Mali) -Globalization.ci_ki = Kikuyu -Globalization.ci_ki-KE = Kikuyu (Kenya) -Globalization.ci_kk = Kazakh -Globalization.ci_kk-KZ = Kazakh (Kazakhstan) -Globalization.ci_kkj = Kako -Globalization.ci_kkj-CM = Kako (Cameroon) -Globalization.ci_kl = Greenlandic -Globalization.ci_kl-GL = Greenlandic (Greenland) -Globalization.ci_kln = Kalenjin -Globalization.ci_kln-KE = Kalenjin (Kenya) -Globalization.ci_km = Khmer -Globalization.ci_km-KH = Khmer (Cambodia) -Globalization.ci_kn = Kannada -Globalization.ci_kn-IN = Kannada (India) -Globalization.ci_ko = Korean -Globalization.ci_ko-KR = Korean (Korea) -Globalization.ci_kok = Konkani -Globalization.ci_kok-IN = Konkani (India) -Globalization.ci_ks = Kashmiri -Globalization.ci_ks-Arab = Kashmiri (Perso-Arabic) -Globalization.ci_ks-Arab-IN = Kashmiri (Perso-Arabic) -Globalization.ci_ksb = Shambala -Globalization.ci_ksb-TZ = Shambala (Tanzania) -Globalization.ci_ksf = Bafia -Globalization.ci_ksf-CM = Bafia (Cameroon) -Globalization.ci_ksh = Colognian -Globalization.ci_ksh-DE = Ripuarian (Germany) -Globalization.ci_ku = Central Kurdish -Globalization.ci_ku-Arab = Central Kurdish (Arabic) -Globalization.ci_ku-Arab-IQ = Central Kurdish (Iraq) -Globalization.ci_kw = Cornish -Globalization.ci_kw-GB = Cornish (United Kingdom) -Globalization.ci_ky = Kyrgyz -Globalization.ci_ky-KG = Kyrgyz (Kyrgyzstan) -Globalization.ci_lag = Langi -Globalization.ci_lag-TZ = Langi (Tanzania) -Globalization.ci_lb = Luxembourgish -Globalization.ci_lb-LU = Luxembourgish (Luxembourg) -Globalization.ci_lg = Ganda -Globalization.ci_lg-UG = Ganda (Uganda) -Globalization.ci_lkt = Lakota -Globalization.ci_lkt-US = Lakota (United States) -Globalization.ci_ln = Lingala -Globalization.ci_ln-AO = Lingala (Angola) -Globalization.ci_ln-CD = Lingala (Congo DRC) -Globalization.ci_ln-CF = Lingala (Central African Republic) -Globalization.ci_ln-CG = Lingala (Congo) -Globalization.ci_lo = Lao -Globalization.ci_lo-LA = Lao (Lao P.D.R.) -Globalization.ci_lt = Lithuanian -Globalization.ci_lt-LT = Lithuanian (Lithuania) -Globalization.ci_lu = Luba-Katanga -Globalization.ci_lu-CD = Luba-Katanga (Congo DRC) -Globalization.ci_luo = Luo -Globalization.ci_luo-KE = Luo (Kenya) -Globalization.ci_luy = Luyia -Globalization.ci_luy-KE = Luyia (Kenya) -Globalization.ci_lv = Latvian -Globalization.ci_lv-LV = Latvian (Latvia) -Globalization.ci_mas = Masai -Globalization.ci_mas-KE = Masai (Kenya) -Globalization.ci_mas-TZ = Masai (Tanzania) -Globalization.ci_mer = Meru -Globalization.ci_mer-KE = Meru (Kenya) -Globalization.ci_mfe = Morisyen -Globalization.ci_mfe-MU = Morisyen (Mauritius) -Globalization.ci_mg = Malagasy -Globalization.ci_mg-MG = Malagasy (Madagascar) -Globalization.ci_mgh = Makhuwa-Meetto -Globalization.ci_mgh-MZ = Makhuwa-Meetto (Mozambique) -Globalization.ci_mgo = Meta' -Globalization.ci_mgo-CM = Meta' (Cameroon) -Globalization.ci_mi = Maori -Globalization.ci_mi-NZ = Maori (New Zealand) -Globalization.ci_mk = Macedonian (FYROM) -Globalization.ci_mk-MK = Macedonian (Former Yugoslav Republic of Macedonia) -Globalization.ci_ml = Malayalam -Globalization.ci_ml-IN = Malayalam (India) -Globalization.ci_mn = Mongolian -Globalization.ci_mn-Cyrl = Mongolian (Cyrillic) -Globalization.ci_mn-MN = Mongolian (Cyrillic, Mongolia) -Globalization.ci_mn-Mong = Mongolian (Traditional Mongolian) -Globalization.ci_mn-Mong-CN = Mongolian (Traditional Mongolian, PRC) -Globalization.ci_mn-Mong-MN = Mongolian (Traditional Mongolian, Mongolia) -Globalization.ci_moh = Mohawk -Globalization.ci_moh-CA = Mohawk (Mohawk) -Globalization.ci_mr = Marathi -Globalization.ci_mr-IN = Marathi (India) -Globalization.ci_ms = Malay -Globalization.ci_ms-BN = Malay (Brunei Darussalam) -Globalization.ci_ms-MY = Malay (Malaysia) -Globalization.ci_ms-SG = Malay (Latin, Singapore) -Globalization.ci_mt = Maltese -Globalization.ci_mt-MT = Maltese (Malta) -Globalization.ci_mua = Mundang -Globalization.ci_mua-CM = Mundang (Cameroon) -Globalization.ci_my = Burmese -Globalization.ci_my-MM = Burmese (Myanmar) -Globalization.ci_naq = Nama -Globalization.ci_naq-NA = Nama (Namibia) -Globalization.ci_nb = Norwegian (Bokmål) -Globalization.ci_nb-NO = Norwegian, Bokmål (Norway) -Globalization.ci_nb-SJ = Norwegian, Bokmål (Svalbard and Jan Mayen) -Globalization.ci_nd = North Ndebele -Globalization.ci_nd-ZW = North Ndebele (Zimbabwe) -Globalization.ci_ne = Nepali -Globalization.ci_ne-IN = Nepali (India) -Globalization.ci_ne-NP = Nepali (Nepal) -Globalization.ci_nl = Dutch -Globalization.ci_nl-AW = Dutch (Aruba) -Globalization.ci_nl-BE = Dutch (Belgium) -Globalization.ci_nl-BQ = Dutch (Bonaire, Sint Eustatius and Saba) -Globalization.ci_nl-CW = Dutch (Curaçao) -Globalization.ci_nl-NL = Dutch (Netherlands) -Globalization.ci_nl-SR = Dutch (Suriname) -Globalization.ci_nl-SX = Dutch (Sint Maarten) -Globalization.ci_nmg = Kwasio -Globalization.ci_nmg-CM = Kwasio (Cameroon) -Globalization.ci_nn = Norwegian (Nynorsk) -Globalization.ci_nn-NO = Norwegian, Nynorsk (Norway) -Globalization.ci_nnh = Ngiemboon -Globalization.ci_nnh-CM = Ngiemboon (Cameroon) -Globalization.ci_no = Norwegian -Globalization.ci_nqo = N'ko -Globalization.ci_nqo-GN = N'ko (Guinea) -Globalization.ci_nr = South Ndebele -Globalization.ci_nr-ZA = South Ndebele (South Africa) -Globalization.ci_nso = Sesotho sa Leboa -Globalization.ci_nso-ZA = Sesotho sa Leboa (South Africa) -Globalization.ci_nus = Nuer -Globalization.ci_nus-SD = Nuer (Sudan) -Globalization.ci_nyn = Nyankole -Globalization.ci_nyn-UG = Nyankole (Uganda) -Globalization.ci_oc = Occitan -Globalization.ci_oc-FR = Occitan (France) -Globalization.ci_om = Oromo -Globalization.ci_om-ET = Oromo (Ethiopia) -Globalization.ci_om-KE = Oromo (Kenya) -Globalization.ci_or = Odia -Globalization.ci_or-IN = Odia (India) -Globalization.ci_os = Ossetic -Globalization.ci_os-GE = Ossetian (Cyrillic, Georgia) -Globalization.ci_os-RU = Ossetian (Cyrillic, Russia) -Globalization.ci_pa = Punjabi -Globalization.ci_pa-Arab = Punjabi (Arabic) -Globalization.ci_pa-Arab-PK = Punjabi (Islamic Republic of Pakistan) -Globalization.ci_pa-IN = Punjabi (India) -Globalization.ci_pl = Polish -Globalization.ci_pl-PL = Polish (Poland) -Globalization.ci_prs = Dari -Globalization.ci_prs-AF = Dari (Afghanistan) -Globalization.ci_ps = Pashto -Globalization.ci_ps-AF = Pashto (Afghanistan) -Globalization.ci_pt = Portuguese -Globalization.ci_pt-AO = Portuguese (Angola) -Globalization.ci_pt-BR = Portuguese (Brazil) -Globalization.ci_pt-CV = Portuguese (Cabo Verde) -Globalization.ci_pt-GW = Portuguese (Guinea-Bissau) -Globalization.ci_pt-MO = Portuguese (Macao SAR) -Globalization.ci_pt-MZ = Portuguese (Mozambique) -Globalization.ci_pt-PT = Portuguese (Portugal) -Globalization.ci_pt-ST = Portuguese (São Tomé and Príncipe) -Globalization.ci_pt-TL = Portuguese (Timor-Leste) -Globalization.ci_qps-ploc = Pseudo Language (Pseudo) -Globalization.ci_qps-ploca = Pseudo Language (Pseudo Asia) -Globalization.ci_qps-plocm = Pseudo Language (Pseudo Mirrored) -Globalization.ci_qu = Quechua -Globalization.ci_qu-BO = Quechua (Bolivia) -Globalization.ci_qu-EC = Quechua (Ecuador) -Globalization.ci_qu-PE = Quechua (Peru) -Globalization.ci_quc = K'iche' -Globalization.ci_quc-Latn = K'iche' -Globalization.ci_quc-Latn-GT = K'iche' (Guatemala) -Globalization.ci_qut = K'iche -Globalization.ci_qut-GT = K'iche (Guatemala) -Globalization.ci_quz = Quechua -Globalization.ci_quz-BO = Quechua (Bolivia) -Globalization.ci_quz-EC = Quechua (Ecuador) -Globalization.ci_quz-PE = Quechua (Peru) -Globalization.ci_rm = Romansh -Globalization.ci_rm-CH = Romansh (Switzerland) -Globalization.ci_rn = Rundi -Globalization.ci_rn-BI = Rundi (Burundi) -Globalization.ci_ro = Romanian -Globalization.ci_ro-MD = Romanian (Moldova) -Globalization.ci_ro-RO = Romanian (Romania) -Globalization.ci_rof = Rombo -Globalization.ci_rof-TZ = Rombo (Tanzania) -Globalization.ci_ru = Russian -Globalization.ci_ru-BY = Russian (Belarus) -Globalization.ci_ru-KG = Russian (Kyrgyzstan) -Globalization.ci_ru-KZ = Russian (Kazakhstan) -Globalization.ci_ru-MD = Russian (Moldova) -Globalization.ci_ru-RU = Russian (Russia) -Globalization.ci_ru-UA = Russian (Ukraine) -Globalization.ci_rw = Kinyarwanda -Globalization.ci_rw-RW = Kinyarwanda (Rwanda) -Globalization.ci_rwk = Rwa -Globalization.ci_rwk-TZ = Rwa (Tanzania) -Globalization.ci_sa = Sanskrit -Globalization.ci_sa-IN = Sanskrit (India) -Globalization.ci_sah = Sakha -Globalization.ci_sah-RU = Sakha (Russia) -Globalization.ci_saq = Samburu -Globalization.ci_saq-KE = Samburu (Kenya) -Globalization.ci_sbp = Sangu -Globalization.ci_sbp-TZ = Sangu (Tanzania) -Globalization.ci_sd = Sindhi -Globalization.ci_sd-Arab = Sindhi (Arabic) -Globalization.ci_sd-Arab-PK = Sindhi (Islamic Republic of Pakistan) -Globalization.ci_se = Sami (Northern) -Globalization.ci_se-FI = Sami, Northern (Finland) -Globalization.ci_se-NO = Sami, Northern (Norway) -Globalization.ci_se-SE = Sami, Northern (Sweden) -Globalization.ci_seh = Sena -Globalization.ci_seh-MZ = Sena (Mozambique) -Globalization.ci_ses = Koyraboro Senni -Globalization.ci_ses-ML = Koyraboro Senni (Mali) -Globalization.ci_sg = Sango -Globalization.ci_sg-CF = Sango (Central African Republic) -Globalization.ci_shi = Tachelhit -Globalization.ci_shi-Latn = Tachelhit (Latin) -Globalization.ci_shi-Latn-MA = Tachelhit (Latin, Morocco) -Globalization.ci_shi-Tfng = Tachelhit (Tifinagh) -Globalization.ci_shi-Tfng-MA = Tachelhit (Tifinagh, Morocco) -Globalization.ci_si = Sinhala -Globalization.ci_si-LK = Sinhala (Sri Lanka) -Globalization.ci_sk = Slovak -Globalization.ci_sk-SK = Slovak (Slovakia) -Globalization.ci_sl = Slovenian -Globalization.ci_sl-SI = Slovenian (Slovenia) -Globalization.ci_sma = Sami (Southern) -Globalization.ci_sma-NO = Sami, Southern (Norway) -Globalization.ci_sma-SE = Sami, Southern (Sweden) -Globalization.ci_smj = Sami (Lule) -Globalization.ci_smj-NO = Sami, Lule (Norway) -Globalization.ci_smj-SE = Sami, Lule (Sweden) -Globalization.ci_smn = Sami (Inari) -Globalization.ci_smn-FI = Sami, Inari (Finland) -Globalization.ci_sms = Sami (Skolt) -Globalization.ci_sms-FI = Sami, Skolt (Finland) -Globalization.ci_sn = Shona -Globalization.ci_sn-Latn = Shona (Latin) -Globalization.ci_sn-Latn-ZW = Shona (Latin, Zimbabwe) -Globalization.ci_so = Somali -Globalization.ci_so-DJ = Somali (Djibouti) -Globalization.ci_so-ET = Somali (Ethiopia) -Globalization.ci_so-KE = Somali (Kenya) -Globalization.ci_so-SO = Somali (Somalia) -Globalization.ci_sq = Albanian -Globalization.ci_sq-AL = Albanian (Albania) -Globalization.ci_sq-MK = Albanian (Macedonia, FYRO) -Globalization.ci_sr = Serbian -Globalization.ci_sr-Cyrl = Serbian (Cyrillic) -Globalization.ci_sr-Cyrl-BA = Serbian (Cyrillic, Bosnia and Herzegovina) -Globalization.ci_sr-Cyrl-CS = Serbian (Cyrillic, Serbia and Montenegro (Former)) -Globalization.ci_sr-Cyrl-ME = Serbian (Cyrillic, Montenegro) -Globalization.ci_sr-Cyrl-RS = Serbian (Cyrillic, Serbia) -Globalization.ci_sr-Latn = Serbian (Latin) -Globalization.ci_sr-Latn-BA = Serbian (Latin, Bosnia and Herzegovina) -Globalization.ci_sr-Latn-CS = Serbian (Latin, Serbia and Montenegro (Former)) -Globalization.ci_sr-Latn-ME = Serbian (Latin, Montenegro) -Globalization.ci_sr-Latn-RS = Serbian (Latin, Serbia) -Globalization.ci_ss = Swati -Globalization.ci_ss-SZ = Swati (Swaziland) -Globalization.ci_ss-ZA = Swati (South Africa) -Globalization.ci_ssy = Saho -Globalization.ci_ssy-ER = Saho (Eritrea) -Globalization.ci_st = Southern Sotho -Globalization.ci_st-LS = Sesotho (Lesotho) -Globalization.ci_st-ZA = Southern Sotho (South Africa) -Globalization.ci_sv = Swedish -Globalization.ci_sv-AX = Swedish (Åland Islands) -Globalization.ci_sv-FI = Swedish (Finland) -Globalization.ci_sv-SE = Swedish (Sweden) -Globalization.ci_sw = Kiswahili -Globalization.ci_sw-KE = Kiswahili (Kenya) -Globalization.ci_sw-TZ = Kiswahili (Tanzania) -Globalization.ci_sw-UG = Kiswahili (Uganda) -Globalization.ci_swc = Congo Swahili -Globalization.ci_swc-CD = Congo Swahili (Congo DRC) -Globalization.ci_syr = Syriac -Globalization.ci_syr-SY = Syriac (Syria) -Globalization.ci_ta = Tamil -Globalization.ci_ta-IN = Tamil (India) -Globalization.ci_ta-LK = Tamil (Sri Lanka) -Globalization.ci_ta-MY = Tamil (Malaysia) -Globalization.ci_ta-SG = Tamil (Singapore) -Globalization.ci_te = Telugu -Globalization.ci_te-IN = Telugu (India) -Globalization.ci_teo = Teso -Globalization.ci_teo-KE = Teso (Kenya) -Globalization.ci_teo-UG = Teso (Uganda) -Globalization.ci_tg = Tajik -Globalization.ci_tg-Cyrl = Tajik (Cyrillic) -Globalization.ci_tg-Cyrl-TJ = Tajik (Cyrillic, Tajikistan) -Globalization.ci_th = Thai -Globalization.ci_th-TH = Thai (Thailand) -Globalization.ci_ti = Tigrinya -Globalization.ci_ti-ER = Tigrinya (Eritrea) -Globalization.ci_ti-ET = Tigrinya (Ethiopia) -Globalization.ci_tig = Tigre -Globalization.ci_tig-ER = Tigre (Eritrea) -Globalization.ci_tk = Turkmen -Globalization.ci_tk-TM = Turkmen (Turkmenistan) -Globalization.ci_tn = Setswana -Globalization.ci_tn-BW = Setswana (Botswana) -Globalization.ci_tn-ZA = Setswana (South Africa) -Globalization.ci_to = Tongan -Globalization.ci_to-TO = Tongan (Tonga) -Globalization.ci_tr = Turkish -Globalization.ci_tr-CY = Turkish (Cyprus) -Globalization.ci_tr-TR = Turkish (Turkey) -Globalization.ci_ts = Tsonga -Globalization.ci_ts-ZA = Tsonga (South Africa) -Globalization.ci_tt = Tatar -Globalization.ci_tt-RU = Tatar (Russia) -Globalization.ci_twq = Tasawaq -Globalization.ci_twq-NE = Tasawaq (Niger) -Globalization.ci_tzm = Tamazight -Globalization.ci_tzm-Latn = Tamazight (Latin) -Globalization.ci_tzm-Latn-DZ = Tamazight (Latin, Algeria) -Globalization.ci_tzm-Latn-MA = Central Atlas Tamazight (Latin, Morocco) -Globalization.ci_tzm-Tfng = Tamazight (Tifinagh) -Globalization.ci_tzm-Tfng-MA = Central Atlas Tamazight (Tifinagh, Morocco) -Globalization.ci_ug = Uyghur -Globalization.ci_ug-CN = Uyghur (PRC) -Globalization.ci_uk = Ukrainian -Globalization.ci_uk-UA = Ukrainian (Ukraine) -Globalization.ci_ur = Urdu -Globalization.ci_ur-IN = Urdu (India) -Globalization.ci_ur-PK = Urdu (Islamic Republic of Pakistan) -Globalization.ci_uz = Uzbek -Globalization.ci_uz-Arab = Uzbek (Perso-Arabic) -Globalization.ci_uz-Arab-AF = Uzbek (Perso-Arabic, Afghanistan) -Globalization.ci_uz-Cyrl = Uzbek (Cyrillic) -Globalization.ci_uz-Cyrl-UZ = Uzbek (Cyrillic, Uzbekistan) -Globalization.ci_uz-Latn = Uzbek (Latin) -Globalization.ci_uz-Latn-UZ = Uzbek (Latin, Uzbekistan) -Globalization.ci_vai = Vai -Globalization.ci_vai-Latn = Vai (Latin) -Globalization.ci_vai-Latn-LR = Vai (Latin, Liberia) -Globalization.ci_vai-Vaii = Vai (Vai) -Globalization.ci_vai-Vaii-LR = Vai (Vai, Liberia) -Globalization.ci_ve = Venda -Globalization.ci_ve-ZA = Venda (South Africa) -Globalization.ci_vi = Vietnamese -Globalization.ci_vi-VN = Vietnamese (Vietnam) -Globalization.ci_vo = Volapük -Globalization.ci_vo-001 = Volapük (World) -Globalization.ci_vun = Vunjo -Globalization.ci_vun-TZ = Vunjo (Tanzania) -Globalization.ci_wae = Walser -Globalization.ci_wae-CH = Walser (Switzerland) -Globalization.ci_wal = Wolaytta -Globalization.ci_wal-ET = Wolaytta (Ethiopia) -Globalization.ci_wo = Wolof -Globalization.ci_wo-SN = Wolof (Senegal) -Globalization.ci_x-IV = Invariant Language (Invariant Country) -Globalization.ci_x-IV_mathan = Invariant Language (Invariant Country) -Globalization.ci_xh = isiXhosa -Globalization.ci_xh-ZA = isiXhosa (South Africa) -Globalization.ci_xog = Soga -Globalization.ci_xog-UG = Soga (Uganda) -Globalization.ci_yav = Yangben -Globalization.ci_yav-CM = Yangben (Cameroon) -Globalization.ci_yi = Yiddish -Globalization.ci_yi-001 = Yiddish (World) -Globalization.ci_yo = Yoruba -Globalization.ci_yo-BJ = Yoruba (Benin) -Globalization.ci_yo-NG = Yoruba (Nigeria) -Globalization.ci_zgh = Standard Moroccan Tamazight -Globalization.ci_zgh-Tfng = Standard Moroccan Tamazight (Tifinagh) -Globalization.ci_zgh-Tfng-MA = Standard Moroccan Tamazight (Tifinagh, Morocco) -Globalization.ci_zh = Chinese -Globalization.ci_zh-CHS = Chinese (Simplified) Legacy -Globalization.ci_zh-CHT = Chinese (Traditional) Legacy -Globalization.ci_zh-CN = Chinese (Simplified, PRC) -Globalization.ci_zh-CN_stroke = Chinese (Simplified, PRC) -Globalization.ci_zh-Hans = Chinese (Simplified) -Globalization.ci_zh-Hant = Chinese (Traditional) -Globalization.ci_zh-HK = Chinese (Traditional, Hong Kong S.A.R.) -Globalization.ci_zh-HK_radstr = Chinese (Traditional, Hong Kong S.A.R.) -Globalization.ci_zh-MO = Chinese (Traditional, Macao S.A.R.) -Globalization.ci_zh-MO_radstr = Chinese (Traditional, Macao S.A.R.) -Globalization.ci_zh-MO_stroke = Chinese (Traditional, Macao S.A.R.) -Globalization.ci_zh-SG = Chinese (Simplified, Singapore) -Globalization.ci_zh-SG_stroke = Chinese (Simplified, Singapore) -Globalization.ci_zh-TW = Chinese (Traditional, Taiwan) -Globalization.ci_zh-TW_pronun = Chinese (Traditional, Taiwan) -Globalization.ci_zh-TW_radstr = Chinese (Traditional, Taiwan) -Globalization.ci_zu = isiZulu -Globalization.ci_zu-ZA = isiZulu (South Africa) -;------------------ -; -;Total items: 129 -; -Globalization.ri_029 = Caribbean -Globalization.ri_AE = U.A.E. -Globalization.ri_AF = Afghanistan -Globalization.ri_AL = Albania -Globalization.ri_AM = Armenia -Globalization.ri_AR = Argentina -Globalization.ri_AT = Austria -Globalization.ri_AU = Australia -Globalization.ri_AZ = Azerbaijan -Globalization.ri_BA = Bosnia and Herzegovina -Globalization.ri_BD = Bangladesh -Globalization.ri_BE = Belgium -Globalization.ri_BG = Bulgaria -Globalization.ri_BH = Bahrain -Globalization.ri_BN = Brunei Darussalam -Globalization.ri_BO = Bolivia -Globalization.ri_BR = Brazil -Globalization.ri_BY = Belarus -Globalization.ri_BZ = Belize -Globalization.ri_CA = Canada -Globalization.ri_CH = Switzerland -Globalization.ri_CL = Chile -Globalization.ri_CN = People's Republic of China -Globalization.ri_CO = Colombia -Globalization.ri_CR = Costa Rica -Globalization.ri_CS = Serbia and Montenegro (Former) -Globalization.ri_CZ = Czech Republic -Globalization.ri_DE = Germany -Globalization.ri_DK = Denmark -Globalization.ri_DO = Dominican Republic -Globalization.ri_DZ = Algeria -Globalization.ri_EC = Ecuador -Globalization.ri_EE = Estonia -Globalization.ri_EG = Egypt -Globalization.ri_ER = Eritrea -Globalization.ri_ES = Spain -Globalization.ri_ET = Ethiopia -Globalization.ri_FI = Finland -Globalization.ri_FO = Faroe Islands -Globalization.ri_FR = France -Globalization.ri_GB = United Kingdom -Globalization.ri_GE = Georgia -Globalization.ri_GL = Greenland -Globalization.ri_GR = Greece -Globalization.ri_GT = Guatemala -Globalization.ri_HK = Hong Kong S.A.R. -Globalization.ri_HN = Honduras -Globalization.ri_HR = Croatia -Globalization.ri_HU = Hungary -Globalization.ri_ID = Indonesia -Globalization.ri_IE = Ireland -Globalization.ri_IL = Israel -Globalization.ri_IN = India -Globalization.ri_IQ = Iraq -Globalization.ri_IR = Iran -Globalization.ri_IS = Iceland -Globalization.ri_IT = Italy -Globalization.ri_IV = Invariant Country -Globalization.ri_JM = Jamaica -Globalization.ri_JO = Jordan -Globalization.ri_JP = Japan -Globalization.ri_KE = Kenya -Globalization.ri_KG = Kyrgyzstan -Globalization.ri_KH = Cambodia -Globalization.ri_KR = Korea -Globalization.ri_KW = Kuwait -Globalization.ri_KZ = Kazakhstan -Globalization.ri_LA = Lao P.D.R. -Globalization.ri_LB = Lebanon -Globalization.ri_LI = Liechtenstein -Globalization.ri_LK = Sri Lanka -Globalization.ri_LT = Lithuania -Globalization.ri_LU = Luxembourg -Globalization.ri_LV = Latvia -Globalization.ri_LY = Libya -Globalization.ri_MA = Morocco -Globalization.ri_MC = Principality of Monaco -Globalization.ri_ME = Montenegro -Globalization.ri_MK = Macedonia (FYROM) -Globalization.ri_MN = Mongolia -Globalization.ri_MO = Macao S.A.R. -Globalization.ri_MT = Malta -Globalization.ri_MV = Maldives -Globalization.ri_MX = Mexico -Globalization.ri_MY = Malaysia -Globalization.ri_NG = Nigeria -Globalization.ri_NI = Nicaragua -Globalization.ri_NL = Netherlands -Globalization.ri_NO = Norway -Globalization.ri_NP = Nepal -Globalization.ri_NZ = New Zealand -Globalization.ri_OM = Oman -Globalization.ri_PA = Panama -Globalization.ri_PE = Peru -Globalization.ri_PH = Philippines -Globalization.ri_PK = Islamic Republic of Pakistan -Globalization.ri_PL = Poland -Globalization.ri_PR = Puerto Rico -Globalization.ri_PT = Portugal -Globalization.ri_PY = Paraguay -Globalization.ri_QA = Qatar -Globalization.ri_RO = Romania -Globalization.ri_RS = Serbia -Globalization.ri_RU = Russia -Globalization.ri_RW = Rwanda -Globalization.ri_SA = Saudi Arabia -Globalization.ri_SE = Sweden -Globalization.ri_SG = Singapore -Globalization.ri_SI = Slovenia -Globalization.ri_SK = Slovakia -Globalization.ri_SN = Senegal -Globalization.ri_SV = El Salvador -Globalization.ri_SY = Syria -Globalization.ri_TH = Thailand -Globalization.ri_TJ = Tajikistan -Globalization.ri_TM = Turkmenistan -Globalization.ri_TN = Tunisia -Globalization.ri_TR = Turkey -Globalization.ri_TT = Trinidad and Tobago -Globalization.ri_TW = Taiwan -Globalization.ri_UA = Ukraine -Globalization.ri_US = United States -Globalization.ri_UY = Uruguay -Globalization.ri_UZ = Uzbekistan -Globalization.ri_VE = Bolivarian Republic of Venezuela -Globalization.ri_VN = Vietnam -Globalization.ri_YE = Yemen -Globalization.ri_ZA = South Africa -Globalization.ri_ZW = Zimbabwe -#endif //!FEATURE_CORECLR - ;------------------ ; Encoding names: ; diff --git a/src/coreclr/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs b/src/coreclr/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs index 7ab7ffb..9f00e81 100644 --- a/src/coreclr/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs +++ b/src/coreclr/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs @@ -30,7 +30,6 @@ namespace System if (!TryParseFrameworkName(targetFrameworkMoniker, out identifier, out version, out profile)) { -#if FEATURE_CORECLR // If we can't parse the TFM or we don't have a TFM, default to latest behavior for all // switches (ie. all of them false). // If we want to use the latest behavior it is enough to set the value of the switch to string.Empty. @@ -39,11 +38,6 @@ namespace System // identifier we are simply saying -- don't turn on any switches, and we are going to get the latest // behavior for all the switches identifier = string.Empty; -#else - identifier = ".NETFramework"; - version = 40000; - profile = string.Empty; -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/CfgParser.cs b/src/coreclr/src/mscorlib/src/System/CfgParser.cs index facf07f..b21da7f 100644 --- a/src/coreclr/src/mscorlib/src/System/CfgParser.cs +++ b/src/coreclr/src/mscorlib/src/System/CfgParser.cs @@ -289,11 +289,7 @@ namespace System // Neither Exception nor ApplicationException are the "right" exceptions here. // Desktop throws ApplicationException for backwards compatibility. // On Silverlight we don't have ApplicationException, so fall back to Exception. -#if FEATURE_CORECLR throw new Exception(message, inner); -#else - throw new ApplicationException(message, inner); -#endif } return rootNode; } @@ -438,11 +434,7 @@ namespace System // Neither Exception nor ApplicationException are the "right" exceptions here. // Desktop throws ApplicationException for backwards compatibility. // On Silverlight we don't have ApplicationException, so fall back to Exception. -#if FEATURE_CORECLR throw new Exception(message); -#else - throw new ApplicationException(message); -#endif } } } diff --git a/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs b/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs index a8516e3..e784c08 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/ArrayList.cs @@ -31,9 +31,7 @@ namespace System.Collections { // of the ArrayList is automatically increased as required by reallocating the // internal array. // -#if FEATURE_CORECLR [FriendAccessAllowed] -#endif [DebuggerTypeProxy(typeof(System.Collections.ArrayList.ArrayListDebugView))] [DebuggerDisplay("Count = {Count}")] [Serializable] @@ -554,9 +552,7 @@ namespace System.Collections { // Returns a read-only IList wrapper for the given IList. // -#if FEATURE_CORECLR [FriendAccessAllowed] -#endif public static IList ReadOnly(IList list) { if (list==null) throw new ArgumentNullException(nameof(list)); diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs index f5dafc0..9409ff5 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs @@ -91,12 +91,12 @@ namespace System.Collections.Generic { if (capacity > 0) Initialize(capacity); this.comparer = comparer ?? EqualityComparer.Default; -#if FEATURE_RANDOMIZED_STRING_HASHING && FEATURE_CORECLR +#if FEATURE_RANDOMIZED_STRING_HASHING if (HashHelpers.s_UseRandomizedStringHashing && comparer == EqualityComparer.Default) { this.comparer = (IEqualityComparer) NonRandomizedStringEqualityComparer.Default; } -#endif // FEATURE_RANDOMIZED_STRING_HASHING && FEATURE_CORECLR +#endif // FEATURE_RANDOMIZED_STRING_HASHING } public Dictionary(IDictionary dictionary): this(dictionary, null) {} @@ -361,11 +361,7 @@ namespace System.Collections.Generic { for (int i = buckets[targetBucket]; i >= 0; i = entries[i].next) { if (entries[i].hashCode == hashCode && comparer.Equals(entries[i].key, key)) { if (add) { -#if FEATURE_CORECLR ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key); -#else - ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_AddingDuplicate); -#endif } entries[i].value = value; version++; @@ -400,8 +396,6 @@ namespace System.Collections.Generic { version++; #if FEATURE_RANDOMIZED_STRING_HASHING - -#if FEATURE_CORECLR // In case we hit the collision threshold we'll need to switch to the comparer which is using randomized string hashing // in this case will be EqualityComparer.Default. // Note, randomized string hashing is turned on by default on coreclr so EqualityComparer.Default will @@ -412,14 +406,6 @@ namespace System.Collections.Generic { comparer = (IEqualityComparer) EqualityComparer.Default; Resize(entries.Length, true); } -#else - if(collisionCount > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(comparer)) - { - comparer = (IEqualityComparer) HashHelpers.GetRandomizedEqualityComparer(comparer); - Resize(entries.Length, true); - } -#endif // FEATURE_CORECLR - #endif } diff --git a/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs b/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs index a14125a..3731114 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs @@ -293,7 +293,6 @@ namespace System.Collections.Generic GetType().GetHashCode(); } -#if FEATURE_CORECLR // NonRandomizedStringEqualityComparer is the comparer used by default with the Dictionary // As the randomized string hashing is turned on by default on coreclr, we need to keep the performance not affected // as much as possible in the main stream scenarios like Dictionary @@ -319,7 +318,6 @@ namespace System.Collections.Generic return obj.GetLegacyNonRandomizedHashCode(); } } -#endif // FEATURE_CORECLR // Performance of IndexOf on byte array is very important for some scenarios. // We will call the C runtime function memchr, which is optimized. diff --git a/src/coreclr/src/mscorlib/src/System/Collections/SortedList.cs b/src/coreclr/src/mscorlib/src/System/Collections/SortedList.cs index 658dc48..6ffd0b0 100644 --- a/src/coreclr/src/mscorlib/src/System/Collections/SortedList.cs +++ b/src/coreclr/src/mscorlib/src/System/Collections/SortedList.cs @@ -60,10 +60,8 @@ namespace System.Collections { // [DebuggerTypeProxy(typeof(System.Collections.SortedList.SortedListDebugView))] [DebuggerDisplay("Count = {Count}")] -[System.Runtime.InteropServices.ComVisible(true)] -#if FEATURE_CORECLR + [System.Runtime.InteropServices.ComVisible(true)] [Obsolete("Non-generic collections have been deprecated. Please use collections in System.Collections.Generic.")] -#endif [Serializable] public class SortedList : IDictionary, ICloneable { diff --git a/src/coreclr/src/mscorlib/src/System/CurrentTimeZone.cs b/src/coreclr/src/mscorlib/src/System/CurrentTimeZone.cs index f98117b..90453438 100644 --- a/src/coreclr/src/mscorlib/src/System/CurrentTimeZone.cs +++ b/src/coreclr/src/mscorlib/src/System/CurrentTimeZone.cs @@ -27,9 +27,7 @@ namespace System { using System.Runtime.CompilerServices; using System.Runtime.Versioning; -#if FEATURE_CORECLR [Obsolete("System.CurrentSystemTimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo.Local instead.")] -#endif [Serializable] internal class CurrentSystemTimeZone : TimeZone { diff --git a/src/coreclr/src/mscorlib/src/System/DateTime.cs b/src/coreclr/src/mscorlib/src/System/DateTime.cs index a650ae6..e93346c 100644 --- a/src/coreclr/src/mscorlib/src/System/DateTime.cs +++ b/src/coreclr/src/mscorlib/src/System/DateTime.cs @@ -556,18 +556,6 @@ namespace System { return millis * TicksPerMillisecond; } -#if !FEATURE_CORECLR - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SuppressUnmanagedCodeSecurity] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool LegacyParseMode(); - - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SuppressUnmanagedCodeSecurity] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool EnableAmPmParseAdjustment(); -#endif - // Checks if this DateTime is equal to a given object. Returns // true if the given object is a boxed DateTime and its value // is equal to the value of this DateTime. Returns false diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs index 2cc84ea..77cc6d8 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Assert.cs @@ -81,26 +81,10 @@ namespace System.Diagnostics { } else if (iResult == AssertFilters.FailTerminate) { -#if FEATURE_CORECLR // We want to exit the Silverlight application, after displaying a message. // Our best known way to emulate this is to exit the process with a known // error code. Jolt may not be prepared for an appdomain to be unloaded. Environment._Exit(exitCode); -#else - // This assert dialog will be common for code contract failures. If a code contract failure - // occurs on an end user machine, we believe the right experience is to do a FailFast, which - // will report this error via Watson, so someone could theoretically fix the bug. - // However, in CLR v4, Environment.FailFast when a debugger is attached gives you an MDA - // saying you've hit a bug in the runtime or unsafe managed code, and this is most likely caused - // by heap corruption or a stack imbalance from COM Interop or P/Invoke. That extremely - // misleading error isn't right, and we can temporarily work around this by using Environment.Exit - // if a debugger is attached. The right fix is to plumb FailFast correctly through our native - // Watson code, adding in a TypeOfReportedError for fatal managed errors. - if (Debugger.IsAttached) - Environment._Exit(exitCode); - else - Environment.FailFast(message, unchecked((uint) exitCode)); -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs index 2973b06..5c4e031 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs @@ -4409,10 +4409,6 @@ namespace System.Diagnostics.Tracing if (!s_EventSourceShutdownRegistered) { s_EventSourceShutdownRegistered = true; -#if (!ES_BUILD_PCL && !FEATURE_CORECLR && !PROJECTN) - AppDomain.CurrentDomain.ProcessExit += DisposeOnShutdown; - AppDomain.CurrentDomain.DomainUnload += DisposeOnShutdown; -#endif } diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs index 390fcab..7dc5d9d 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs @@ -61,14 +61,12 @@ namespace System.Diagnostics { IntPtr inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset, out string sourceFile, out int sourceLine, out int sourceColumn); -#if FEATURE_CORECLR private static Type s_symbolsType = null; private static MethodInfo s_symbolsMethodInfo = null; [ThreadStatic] private static int t_reentrancy = 0; -#endif - + public StackFrameHelper(Thread target) { targetThread = target; @@ -111,7 +109,6 @@ namespace System.Diagnostics { { StackTrace.GetStackFramesInternal(this, iSkip, fNeedFileInfo, exception); -#if FEATURE_CORECLR if (!fNeedFileInfo) return; @@ -164,12 +161,10 @@ namespace System.Diagnostics { { t_reentrancy--; } -#endif } void IDisposable.Dispose() { -#if FEATURE_CORECLR if (getSourceLineInfo != null) { IDisposable disposable = getSourceLineInfo.Target as IDisposable; @@ -178,7 +173,6 @@ namespace System.Diagnostics { disposable.Dispose(); } } -#endif } public virtual MethodBase GetMethodBase(int i) @@ -264,8 +258,6 @@ namespace System.Diagnostics { // In order to ensure trusted code can trust the data it gets from a // StackTrace, we use an InheritanceDemand to prevent partially-trusted // subclasses. -#if !FEATURE_CORECLR -#endif [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class StackTrace @@ -621,26 +613,22 @@ namespace System.Diagnostics { else fFirstTyParam = false; - sb.Append(typars[k].Name); + sb.Append(typars[k].Name); k++; } sb.Append(']'); } ParameterInfo[] pi = null; -#if FEATURE_CORECLR try { -#endif pi = mb.GetParameters(); -#if FEATURE_CORECLR } catch { // The parameter info cannot be loaded, so we don't // append the parameter list. } -#endif if (pi != null) { // arguments printing diff --git a/src/coreclr/src/mscorlib/src/System/Exception.cs b/src/coreclr/src/mscorlib/src/System/Exception.cs index ff714a7..881c9a3 100644 --- a/src/coreclr/src/mscorlib/src/System/Exception.cs +++ b/src/coreclr/src/mscorlib/src/System/Exception.cs @@ -910,10 +910,6 @@ namespace System { private static extern void GetMessageFromNativeResources(ExceptionMessageKind kind, StringHandleOnStack retMesg); } - - -#if FEATURE_CORECLR - //-------------------------------------------------------------------------- // Telesto: Telesto doesn't support appdomain marshaling of objects so // managed exceptions that leak across appdomain boundaries are flatted to @@ -939,10 +935,6 @@ namespace System { { return Message; } - } -#endif - - } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs index dc37cb0..f39ffbc 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureData.cs @@ -1889,7 +1889,6 @@ namespace System.Globalization // Want 1st calendar to be default // Prior to Vista the enumeration didn't have default calendar first // Only a coreclr concern, culture.dll does the right thing. -#if FEATURE_CORECLR if (temp.Length > 1) { int i = DoGetLocaleInfoInt(LOCALE_ICALENDARTYPE); @@ -1899,7 +1898,6 @@ namespace System.Globalization temp[0] = i; } } -#endif this.waCalendars = temp; } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs index 3792097..fe5f8aa 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.cs @@ -84,7 +84,7 @@ namespace System.Globalization { #if FEATURE_LEAK_CULTURE_INFO [NonSerialized]private bool m_isSafeCrossDomain; [NonSerialized]private int m_createdDomainID; -#endif // !FEATURE_CORECLR +#endif // !FEATURE_LEAK_CULTURE_INFO [NonSerialized]private CultureInfo m_consoleFallbackCulture; // Names are confusing. Here are 3 names we have: @@ -1936,11 +1936,8 @@ namespace System.Globalization { [return: MarshalAs(UnmanagedType.Bool)] private static extern bool InternalGetSystemDefaultUILanguage(StringHandleOnStack systemDefaultUiLanguage); -// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5 -#if FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String[] nativeGetResourceFallbackArray(); -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs index 82fca3a..10aa1cf 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormat.cs @@ -707,24 +707,13 @@ namespace System { // accurate than the system's current offset because of daylight saving time. offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime); } else if (dateTime.Kind == DateTimeKind.Utc) { -#if FEATURE_CORECLR offset = TimeSpan.Zero; -#else // FEATURE_CORECLR - // This code path points to a bug in user code. It would make sense to return a 0 offset in this case. - // However, because it was only possible to detect this in Whidbey, there is user code that takes a - // dependency on being serialize a UTC DateTime using the 'z' format, and it will work almost all the - // time if it is offset by an incorrect conversion to local time when parsed. Therefore, we need to - // explicitly emit the local time offset, which we can do by removing the UTC flag. - InvalidFormatForUtc(format, dateTime); - dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local); - offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); -#endif // FEATURE_CORECLR } else { offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); } } if (offset >= TimeSpan.Zero) { - result.Append('+'); + result.Append('+'); } else { result.Append('-'); diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs index e4bd411..f9b5ddf 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs @@ -541,12 +541,11 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (this.amDesignator == null) { this.amDesignator = this.m_cultureData.SAM1159; } -#endif + Contract.Assert(this.amDesignator != null, "DateTimeFormatInfo.AMDesignator, amDesignator != null"); return (this.amDesignator); } @@ -821,12 +820,11 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (this.dateSeparator == null) { this.dateSeparator = this.m_cultureData.DateSeparator(Calendar.ID); } -#endif + Contract.Assert(this.dateSeparator != null, "DateTimeFormatInfo.DateSeparator, dateSeparator != null"); return (this.dateSeparator); } @@ -851,14 +849,12 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (this.firstDayOfWeek == -1) { this.firstDayOfWeek = this.m_cultureData.IFIRSTDAYOFWEEK; } -#endif + Contract.Assert(this.firstDayOfWeek != -1, "DateTimeFormatInfo.FirstDayOfWeek, firstDayOfWeek != -1"); - return ((DayOfWeek)this.firstDayOfWeek); } @@ -880,12 +876,11 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (this.calendarWeekRule == -1) { this.calendarWeekRule = this.m_cultureData.IFIRSTWEEKOFYEAR; } -#endif + Contract.Assert(this.calendarWeekRule != -1, "DateTimeFormatInfo.CalendarWeekRule, calendarWeekRule != -1"); return ((CalendarWeekRule)this.calendarWeekRule); } @@ -1042,12 +1037,11 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (this.pmDesignator == null) { this.pmDesignator = this.m_cultureData.SPM2359; } -#endif + Contract.Assert(this.pmDesignator != null, "DateTimeFormatInfo.PMDesignator, pmDesignator != null"); return (this.pmDesignator); } @@ -1264,12 +1258,11 @@ namespace System.Globalization { { get { -#if FEATURE_CORECLR if (timeSeparator == null) { timeSeparator = this.m_cultureData.TimeSeparator; } -#endif + Contract.Assert(this.timeSeparator != null, "DateTimeFormatInfo.TimeSeparator, timeSeparator != null"); return (timeSeparator); } diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs index 52921ed..4364852 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/DateTimeParse.cs @@ -2522,17 +2522,15 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // no adjustment is required in most cases return DateTimeOffsetTimeZonePostProcessing(ref result, styles); } -#if FEATURE_CORECLR // on CoreCLR DateTime is also restricted to +- 14:00, just like DateTimeOffset else { Int64 offsetTicks = result.timeZoneOffset.Ticks; - + // the DateTime offset must be within +- 14:00 hours. if (offsetTicks < DateTimeOffset.MinOffset || offsetTicks > DateTimeOffset.MaxOffset) { result.SetFailure(ParseFailureKind.Format, "Format_OffsetOutOfRange", null); return false; } } -#endif // FEATURE_CORECLR // The flags AssumeUniveral and AssumeLocal only apply when the input does not have a time zone if ((result.flags & ParseFlags.TimeZoneUsed) == 0) { diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs b/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs index 9b12bde..9430c56 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/RegionInfo.cs @@ -133,18 +133,9 @@ namespace System.Globalization { private void SetName(string name) { -#if FEATURE_CORECLR // Use the name of the region we found this.m_name = this.m_cultureData.SREGIONNAME; -#else - // when creating region by culture name, we keep the region name as the culture name so regions - // created by custom culture names can be differentiated from built in regions. - this.m_name = name.Equals(this.m_cultureData.SREGIONNAME, StringComparison.OrdinalIgnoreCase) ? - this.m_cultureData.SREGIONNAME : - this.m_cultureData.CultureName; -#endif // FEATURE_CORECLR } - #region Serialization // diff --git a/src/coreclr/src/mscorlib/src/System/IO/Directory.cs b/src/coreclr/src/mscorlib/src/System/IO/Directory.cs index 82f07f0..1caec73 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/Directory.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/Directory.cs @@ -881,17 +881,12 @@ namespace System.IO if (PathInternal.IsDirectoryTooLong(destPath)) throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong")); -#if FEATURE_CORECLR if (checkHost) { FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, sourceDirName, sourcePath); FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, destPath); sourceState.EnsureState(); destState.EnsureState(); } -#else - FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, sourcePath, false, false); - FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, destPath, false, false); -#endif if (String.Compare(sourcePath, destPath, StringComparison.OrdinalIgnoreCase) == 0) throw new IOException(Environment.GetResourceString("IO.IO_SourceDestMustBeDifferent")); @@ -943,17 +938,12 @@ namespace System.IO // If not recursive, do permission check only on this directory // else check for the whole directory structure rooted below demandPath = GetDemandDir(fullPath, !recursive); - -#if FEATURE_CORECLR + if (checkHost) { FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, userPath, demandPath); state.EnsureState(); } -#else - // Make sure we have write permission to this directory - new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandPath }, false, false ).Demand(); -#endif // Do not recursively delete through reparse points. Perhaps in a // future version we will add a new flag to control this behavior, diff --git a/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs b/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs index 47323f5..45447e0 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/DirectoryInfo.cs @@ -129,12 +129,10 @@ namespace System.IO if (parentName==null) return null; DirectoryInfo dir = new DirectoryInfo(parentName,false); -#if FEATURE_CORECLR + FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery | FileSecurityStateAccess.Read, String.Empty, dir.demandDir[0]); state.EnsureState(); -#else - new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, dir.demandDir, false, false).Demand(); -#endif + return dir; } } @@ -455,12 +453,9 @@ namespace System.IO String rootPath = FullPath.Substring(0, rootLength); demandPath = Directory.GetDemandDir(rootPath, true); -#if FEATURE_CORECLR FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath); sourceState.EnsureState(); -#else - new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { demandPath }, false, false).Demand(); -#endif + return new DirectoryInfo(rootPath); } } @@ -471,13 +466,10 @@ namespace System.IO if (destDirName.Length==0) throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), nameof(destDirName)); Contract.EndContractBlock(); - -#if FEATURE_CORECLR + FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, DisplayPath, Directory.GetDemandDir(FullPath, true)); sourceState.EnsureState(); -#else - new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandDir, false, false).Demand(); -#endif + String fullDestDirName = Path.GetFullPath(destDirName); String demandPath; if (!fullDestDirName.EndsWith(Path.DirectorySeparatorChar)) @@ -491,13 +483,9 @@ namespace System.IO // had the ability to read the file contents in the old location, // but you technically also need read permissions to the new // location as well, and write is not a true superset of read. -#if FEATURE_CORECLR FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, demandPath); destState.EnsureState(); -#else - new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandPath).Demand(); -#endif - + String fullSourcePath; if (FullPath.EndsWith(Path.DirectorySeparatorChar)) fullSourcePath = FullPath; @@ -566,11 +554,7 @@ namespace System.IO } else { -#if FEATURE_CORECLR displayName = GetDirName(fullPath); -#else - displayName = originalPath; -#endif } return displayName; } diff --git a/src/coreclr/src/mscorlib/src/System/IO/File.cs b/src/coreclr/src/mscorlib/src/System/IO/File.cs index da58cdd..f98f13f 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/File.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/File.cs @@ -320,15 +320,11 @@ namespace System.IO return false; } -#if FEATURE_CORECLR if (checkHost) { FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, path); state.EnsureState(); } -#else - FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, path, false, false); -#endif return InternalExists(path); } diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs b/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs index 9054621..48415d5 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/FileSystemEnumerable.cs @@ -221,7 +221,7 @@ namespace System.IO // Do a demand on the combined path so that we can fail early in case of deny demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true); _checkHost = checkHost; -#if FEATURE_CORECLR + if (checkHost) { FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]); @@ -229,9 +229,6 @@ namespace System.IO FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]); state2.EnsureState(); } -#else - new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand(); -#endif // normalize search criteria searchCriteria = GetNormalizedSearchCriteria(fullSearchString, normalizedSearchPath); @@ -325,7 +322,7 @@ namespace System.IO // For filters like foo\*.cs we need to verify if the directory foo is not denied access. // Do a demand on the combined path so that we can fail early in case of deny demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true); -#if FEATURE_CORECLR + if (checkHost) { FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]); @@ -333,9 +330,7 @@ namespace System.IO FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]); state2.EnsureState(); } -#else - new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand(); -#endif + searchData = new Directory.SearchData(normalizedSearchPath, userPath, searchOption); CommonInit(); } @@ -571,17 +566,11 @@ namespace System.IO internal void DoDemand(String fullPathToDemand) { -#if FEATURE_CORECLR if(_checkHost) { String demandDir = Directory.GetDemandDir(fullPathToDemand, true); FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandDir); state.EnsureState(); } -#else - String demandDir = Directory.GetDemandDir(fullPathToDemand, true); - String[] demandPaths = new String[] { demandDir }; - new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand(); -#endif } private static String NormalizeSearchPattern(String searchPattern) @@ -684,13 +673,10 @@ namespace System.IO internal override FileInfo CreateObject(SearchResult result) { String name = result.FullPath; -#if FEATURE_CORECLR + FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name); state.EnsureState(); -#else - String[] names = new String[] { name }; - new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand(); -#endif + FileInfo fi = new FileInfo(name, false); fi.InitializeFrom(result.FindData); return fi; @@ -708,14 +694,10 @@ namespace System.IO { String name = result.FullPath; String permissionName = name + "\\."; - -#if FEATURE_CORECLR + FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName); state.EnsureState(); -#else - String[] permissionNames = new String[] { permissionName }; - new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand(); -#endif + DirectoryInfo di = new DirectoryInfo(name, false); di.InitializeFrom(result.FindData); return di; @@ -744,13 +726,9 @@ namespace System.IO String name = result.FullPath; String permissionName = name + "\\."; -#if FEATURE_CORECLR FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName); state.EnsureState(); -#else - String[] permissionNames = new String[] { permissionName }; - new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand(); -#endif + DirectoryInfo di = new DirectoryInfo(name, false); di.InitializeFrom(result.FindData); return di; @@ -760,13 +738,9 @@ namespace System.IO Contract.Assert(isFile); String name = result.FullPath; -#if FEATURE_CORECLR FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name); state.EnsureState(); -#else - String[] names = new String[] { name }; - new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand(); -#endif + FileInfo fi = new FileInfo(name, false); fi.InitializeFrom(result.FindData); return fi; diff --git a/src/coreclr/src/mscorlib/src/System/IO/Stream.cs b/src/coreclr/src/mscorlib/src/System/IO/Stream.cs index 1d4441a..d3d90f7 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/Stream.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/Stream.cs @@ -15,12 +15,9 @@ ** ===========================================================*/ using System; -#if FEATURE_CORECLR using System.Buffers; -#endif using System.Threading; using System.Threading.Tasks; - using System.Runtime; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -117,7 +114,6 @@ namespace System.IO { { int bufferSize = _DefaultCopyBufferSize; -#if FEATURE_CORECLR if (CanSeek) { long length = Length; @@ -146,8 +142,7 @@ namespace System.IO { bufferSize = (int)Math.Min(bufferSize, remaining); } } -#endif // FEATURE_CORECLR - + return CopyToAsync(destination, bufferSize); } @@ -174,7 +169,6 @@ namespace System.IO { Contract.Requires(CanRead); Contract.Requires(destination.CanWrite); -#if FEATURE_CORECLR byte[] buffer = ArrayPool.Shared.Rent(bufferSize); bufferSize = 0; // reuse same field for high water mark to avoid needing another field in the state machine try @@ -192,15 +186,6 @@ namespace System.IO { Array.Clear(buffer, 0, bufferSize); // clear only the most we used ArrayPool.Shared.Return(buffer, clearArray: false); } -#else - byte[] buffer = new byte[bufferSize]; - while (true) - { - int bytesRead = await ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false); - if (bytesRead == 0) break; - await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false); - } -#endif } // Reads the bytes from the current stream and writes the bytes to @@ -210,7 +195,6 @@ namespace System.IO { { int bufferSize = _DefaultCopyBufferSize; -#if FEATURE_CORECLR if (CanSeek) { long length = Length; @@ -229,8 +213,7 @@ namespace System.IO { bufferSize = (int)Math.Min(bufferSize, remaining); } } -#endif // FEATURE_CORECLR - + CopyTo(destination, bufferSize); } @@ -238,7 +221,6 @@ namespace System.IO { { StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize); -#if FEATURE_CORECLR byte[] buffer = ArrayPool.Shared.Rent(bufferSize); int highwaterMark = 0; try @@ -255,14 +237,6 @@ namespace System.IO { Array.Clear(buffer, 0, highwaterMark); // clear only the most we used ArrayPool.Shared.Return(buffer, clearArray: false); } -#else - byte[] buffer = new byte[bufferSize]; - int read; - while ((read = Read(buffer, 0, buffer.Length)) != 0) - { - destination.Write(buffer, 0, read); - } -#endif } // Stream used to require that all cleanup logic went into Close(), diff --git a/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs b/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs index bb4aee7..d95121a 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/StreamWriter.cs @@ -206,11 +206,7 @@ namespace System.IO // is generally the right thing to do. if (stream != null) { // Note: flush on the underlying stream can throw (ex., low disk space) -#if FEATURE_CORECLR if (disposing) -#else - if (disposing || (LeaveOpen && stream is __ConsoleStream)) -#endif { CheckAsyncTaskInProgress(); diff --git a/src/coreclr/src/mscorlib/src/System/IntPtr.cs b/src/coreclr/src/mscorlib/src/System/IntPtr.cs index f3da81d..2d66652 100644 --- a/src/coreclr/src/mscorlib/src/System/IntPtr.cs +++ b/src/coreclr/src/mscorlib/src/System/IntPtr.cs @@ -103,16 +103,12 @@ namespace System { } public unsafe override int GetHashCode() { -#if FEATURE_CORECLR #if BIT64 long l = (long)m_value; return (unchecked((int)l) ^ (int)(l >> 32)); #else // !BIT64 (32) return unchecked((int)m_value); #endif -#else - return unchecked((int)((long)m_value)); -#endif } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] diff --git a/src/coreclr/src/mscorlib/src/System/Internal.cs b/src/coreclr/src/mscorlib/src/System/Internal.cs index cd7166d..0eb2bce 100644 --- a/src/coreclr/src/mscorlib/src/System/Internal.cs +++ b/src/coreclr/src/mscorlib/src/System/Internal.cs @@ -85,16 +85,15 @@ namespace System new Dictionary(); new Dictionary(); new Dictionary(); -#if FEATURE_CORECLR + // to genereate mdil for Dictionary instantiation when key is user defined value type new Dictionary(); -#endif - // Microsoft.Windows.Design + // Microsoft.Windows.Design new Dictionary(); new EnumEqualityComparer(); - // Microsoft.Expression.DesignModel + // Microsoft.Expression.DesignModel new Dictionary>(); new Dictionary, Object>(); @@ -157,14 +156,12 @@ namespace System SZArrayHelper(null); SZArrayHelper(null); -#if FEATURE_CORECLR #pragma warning disable 4014 // This is necessary to generate MDIL for AsyncVoidMethodBuilder AsyncHelper(); AsyncHelper2(); AsyncHelper3(); #pragma warning restore 4014 -#endif } static T NullableHelper() where T : struct @@ -183,7 +180,6 @@ namespace System oSZArrayHelper.GetEnumerator(); } -#if FEATURE_CORECLR // System.Runtime.CompilerServices.AsyncVoidMethodBuilder // System.Runtime.CompilerServices.TaskAwaiter static async void AsyncHelper() @@ -203,7 +199,6 @@ namespace System { await Task.FromResult(""); } -#endif #if FEATURE_COMINTEROP diff --git a/src/coreclr/src/mscorlib/src/System/Lazy.cs b/src/coreclr/src/mscorlib/src/System/Lazy.cs index 07863d1..3f8151c 100644 --- a/src/coreclr/src/mscorlib/src/System/Lazy.cs +++ b/src/coreclr/src/mscorlib/src/System/Lazy.cs @@ -48,9 +48,6 @@ namespace System /// [Serializable] [ComVisible(false)] -#if !FEATURE_CORECLR - [HostProtection(Synchronization = true, ExternalThreading = true)] -#endif [DebuggerTypeProxy(typeof(System_LazyDebugView<>))] [DebuggerDisplay("ThreadSafetyMode={Mode}, IsValueCreated={IsValueCreated}, IsValueFaulted={IsValueFaulted}, Value={ValueForDebugDisplay}")] public class Lazy @@ -341,13 +338,7 @@ namespace System } // Fall through to the slow path. -#if !FEATURE_CORECLR - // We call NOCTD to abort attempts by the debugger to funceval this property (e.g. on mouseover) - // (the debugger proxy is the correct way to look at state/value of this object) - Debugger.NotifyOfCrossThreadDependency(); -#endif return LazyInitValue(); - } } diff --git a/src/coreclr/src/mscorlib/src/System/Object.cs b/src/coreclr/src/mscorlib/src/System/Object.cs index 13cddb5..d8d9a0e 100644 --- a/src/coreclr/src/mscorlib/src/System/Object.cs +++ b/src/coreclr/src/mscorlib/src/System/Object.cs @@ -211,22 +211,16 @@ internal class __Canon // This class is used to define the name of the base class library internal class CoreLib { - -#if FEATURE_CORECLR public const string Name = "System.Private.CoreLib"; -#else - public const string Name = "mscorlib"; -#endif public static string FixupCoreLibName(string strToFixup) { -#if FEATURE_CORECLR if (!String.IsNullOrEmpty(strToFixup)) { strToFixup = strToFixup.Replace("mscorlib", System.CoreLib.Name); } -#endif - return strToFixup; + + return strToFixup; } } diff --git a/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs b/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs index c986f67..acae95a 100644 --- a/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs +++ b/src/coreclr/src/mscorlib/src/System/OleAutBinder.cs @@ -59,24 +59,6 @@ namespace System { return Enum.Parse(type, value.ToString()); } -#if !FEATURE_CORECLR - // Special case the convertion from DBNull. - if (srcType == typeof(DBNull)) - { - // The requested type is a DBNull so no convertion is required. - if (type == typeof(DBNull)) - return value; - - // Visual J++ supported converting from DBNull to null so customers - // have requested (via a CDCR) that DBNull be convertible to null. - // We don't however allow this when converting to a value class, since null - // doesn't make sense for these, or to object since this would change existing - // semantics. - if ((type.IsClass && type != typeof(Object)) || type.IsInterface) - return null; - } -#endif //!FEATURE_CORECLR - // Use the OA variant lib to convert primitive types. try { @@ -106,7 +88,5 @@ namespace System { throw new COMException(Environment.GetResourceString("Interop.COM_TypeMismatch"), unchecked((int)0x80020005)); } } - - } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ComInterfaces.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ComInterfaces.cs index e0625f8..6e4b0cc 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ComInterfaces.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ComInterfaces.cs @@ -2,158 +2,15 @@ // 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.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Security.Permissions; -using System.Security.Policy; - namespace System.Runtime.InteropServices { [GuidAttribute("BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2")] [CLSCompliant(false)] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [TypeLibImportClassAttribute(typeof(System.Type))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _Type { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region Type Members - Guid GUID { get; } - Module Module { get; } - Assembly Assembly { get; } - RuntimeTypeHandle TypeHandle { get; } - String FullName { get; } - String Namespace { get; } - String AssemblyQualifiedName { get; } - int GetArrayRank(); - Type BaseType { get; } - - ConstructorInfo[] GetConstructors(BindingFlags bindingAttr); - Type GetInterface(String name, bool ignoreCase); - Type[] GetInterfaces(); - Type[] FindInterfaces(TypeFilter filter,Object filterCriteria); - EventInfo GetEvent(String name,BindingFlags bindingAttr); - EventInfo[] GetEvents(); - EventInfo[] GetEvents(BindingFlags bindingAttr); - Type[] GetNestedTypes(BindingFlags bindingAttr); - Type GetNestedType(String name, BindingFlags bindingAttr); - MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr); - MemberInfo[] GetDefaultMembers(); - MemberInfo[] FindMembers(MemberTypes memberType,BindingFlags bindingAttr,MemberFilter filter,Object filterCriteria); - Type GetElementType(); - bool IsSubclassOf(Type c); - bool IsInstanceOfType(Object o); - bool IsAssignableFrom(Type c); - InterfaceMapping GetInterfaceMap(Type interfaceType); - MethodInfo GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers); - MethodInfo GetMethod(String name, BindingFlags bindingAttr); - MethodInfo[] GetMethods(BindingFlags bindingAttr); - FieldInfo GetField(String name, BindingFlags bindingAttr); - FieldInfo[] GetFields(BindingFlags bindingAttr); - PropertyInfo GetProperty(String name, BindingFlags bindingAttr); - PropertyInfo GetProperty(String name,BindingFlags bindingAttr,Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers); - PropertyInfo[] GetProperties(BindingFlags bindingAttr); - MemberInfo[] GetMember(String name, BindingFlags bindingAttr); - MemberInfo[] GetMembers(BindingFlags bindingAttr); - Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters); - Type UnderlyingSystemType - { - get; - } - - Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder, Object target, Object[] args, CultureInfo culture); - Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder, Object target, Object[] args); - ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers); - ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers); - ConstructorInfo GetConstructor(Type[] types); - ConstructorInfo[] GetConstructors(); - ConstructorInfo TypeInitializer - { - get; - } - - MethodInfo GetMethod(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers); - MethodInfo GetMethod(String name, Type[] types, ParameterModifier[] modifiers); - MethodInfo GetMethod(String name, Type[] types); - MethodInfo GetMethod(String name); - MethodInfo[] GetMethods(); - FieldInfo GetField(String name); - FieldInfo[] GetFields(); - Type GetInterface(String name); - EventInfo GetEvent(String name); - PropertyInfo GetProperty(String name, Type returnType, Type[] types,ParameterModifier[] modifiers); - PropertyInfo GetProperty(String name, Type returnType, Type[] types); - PropertyInfo GetProperty(String name, Type[] types); - PropertyInfo GetProperty(String name, Type returnType); - PropertyInfo GetProperty(String name); - PropertyInfo[] GetProperties(); - Type[] GetNestedTypes(); - Type GetNestedType(String name); - MemberInfo[] GetMember(String name); - MemberInfo[] GetMembers(); - TypeAttributes Attributes { get; } - bool IsNotPublic { get; } - bool IsPublic { get; } - bool IsNestedPublic { get; } - bool IsNestedPrivate { get; } - bool IsNestedFamily { get; } - bool IsNestedAssembly { get; } - bool IsNestedFamANDAssem { get; } - bool IsNestedFamORAssem { get; } - bool IsAutoLayout { get; } - bool IsLayoutSequential { get; } - bool IsExplicitLayout { get; } - bool IsClass { get; } - bool IsInterface { get; } - bool IsValueType { get; } - bool IsAbstract { get; } - bool IsSealed { get; } - bool IsEnum { get; } - bool IsSpecialName { get; } - bool IsImport { get; } - bool IsSerializable { get; } - bool IsAnsiClass { get; } - bool IsUnicodeClass { get; } - bool IsAutoClass { get; } - bool IsArray { get; } - bool IsByRef { get; } - bool IsPointer { get; } - bool IsPrimitive { get; } - bool IsCOMObject { get; } - bool HasElementType { get; } - bool IsContextful { get; } - bool IsMarshalByRef { get; } - bool Equals(Type o); - #endregion -#endif } [GuidAttribute("17156360-2f1a-384a-bc52-fde93c215c5b")] @@ -172,34 +29,8 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _MemberInfo { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion -#endif } - [GuidAttribute("6240837A-707F-3181-8E98-A36AE086766B")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] @@ -207,57 +38,8 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _MethodBase { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region MethodBase Members - ParameterInfo[] GetParameters(); - MethodImplAttributes GetMethodImplementationFlags(); - RuntimeMethodHandle MethodHandle { get; } - MethodAttributes Attributes { get; } - CallingConventions CallingConvention { get; } - Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture); - bool IsPublic { get; } - bool IsPrivate { get; } - bool IsFamily { get; } - bool IsAssembly { get; } - bool IsFamilyAndAssembly { get; } - bool IsFamilyOrAssembly { get; } - bool IsStatic { get; } - bool IsFinal { get; } - bool IsVirtual { get; } - bool IsHideBySig { get; } - bool IsAbstract { get; } - bool IsSpecialName { get; } - bool IsConstructor { get; } - Object Invoke(Object obj, Object[] parameters); - #endregion -#endif } - [GuidAttribute("FFCC1B5D-ECB8-38DD-9B01-3DC8ABC2AA5F")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] @@ -265,62 +47,7 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _MethodInfo { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region MethodBase Members - ParameterInfo[] GetParameters(); - MethodImplAttributes GetMethodImplementationFlags(); - RuntimeMethodHandle MethodHandle { get; } - MethodAttributes Attributes { get; } - CallingConventions CallingConvention { get; } - Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture); - bool IsPublic { get; } - bool IsPrivate { get; } - bool IsFamily { get; } - bool IsAssembly { get; } - bool IsFamilyAndAssembly { get; } - bool IsFamilyOrAssembly { get; } - bool IsStatic { get; } - bool IsFinal { get; } - bool IsVirtual { get; } - bool IsHideBySig { get; } - bool IsAbstract { get; } - bool IsSpecialName { get; } - bool IsConstructor { get; } - Object Invoke(Object obj, Object[] parameters); - #endregion - - #region MethodInfo Members - Type ReturnType { get; } - ICustomAttributeProvider ReturnTypeCustomAttributes { get; } - MethodInfo GetBaseDefinition(); - #endregion -#endif } - [GuidAttribute("E9A19478-9646-3679-9B10-8411AE1FD57D")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] @@ -329,174 +56,26 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _ConstructorInfo { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region MethodBase Members - ParameterInfo[] GetParameters(); - MethodImplAttributes GetMethodImplementationFlags(); - RuntimeMethodHandle MethodHandle { get; } - MethodAttributes Attributes { get; } - CallingConventions CallingConvention { get; } - Object Invoke_2(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture); - bool IsPublic { get; } - bool IsPrivate { get; } - bool IsFamily { get; } - bool IsAssembly { get; } - bool IsFamilyAndAssembly { get; } - bool IsFamilyOrAssembly { get; } - bool IsStatic { get; } - bool IsFinal { get; } - bool IsVirtual { get; } - bool IsHideBySig { get; } - bool IsAbstract { get; } - bool IsSpecialName { get; } - bool IsConstructor { get; } - Object Invoke_3(Object obj, Object[] parameters); - #endregion - - #region ConstructorInfo - Object Invoke_4(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture); - Object Invoke_5(Object[] parameters); - #endregion -#endif } - [GuidAttribute("8A7C1442-A9FB-366B-80D8-4939FFA6DBE0")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.FieldInfo))] [System.Runtime.InteropServices.ComVisible(true)] public interface _FieldInfo - { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region FieldInfo Members - Type FieldType { get; } - Object GetValue(Object obj); - Object GetValueDirect(TypedReference obj); - void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture); - void SetValueDirect(TypedReference obj,Object value); - RuntimeFieldHandle FieldHandle { get; } - FieldAttributes Attributes { get; } - void SetValue(Object obj, Object value); - bool IsPublic { get; } - bool IsPrivate { get; } - bool IsFamily { get; } - bool IsAssembly { get; } - bool IsFamilyAndAssembly { get; } - bool IsFamilyOrAssembly { get; } - bool IsStatic { get; } - bool IsInitOnly { get; } - bool IsLiteral { get; } - bool IsNotSerialized { get; } - bool IsSpecialName { get; } - bool IsPinvokeImpl { get; } - #endregion -#endif + { } - [GuidAttribute("F59ED4E4-E68F-3218-BD77-061AA82824BF")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.PropertyInfo))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _PropertyInfo { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region Property Members - Type PropertyType { get; } - Object GetValue(Object obj,Object[] index); - Object GetValue(Object obj,BindingFlags invokeAttr,Binder binder, Object[] index, CultureInfo culture); - void SetValue(Object obj, Object value, Object[] index); - void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture); - MethodInfo[] GetAccessors(bool nonPublic); - MethodInfo GetGetMethod(bool nonPublic); - MethodInfo GetSetMethod(bool nonPublic); - ParameterInfo[] GetIndexParameters(); - PropertyAttributes Attributes { get; } - bool CanRead { get; } - bool CanWrite { get; } - MethodInfo[] GetAccessors(); - MethodInfo GetGetMethod(); - MethodInfo GetSetMethod(); - bool IsSpecialName { get; } - #endregion -#endif } - [GuidAttribute("9DE59C64-D889-35A1-B897-587D74469E5B")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] @@ -504,91 +83,33 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _EventInfo { -#if !FEATURE_CORECLR - #region IDispatch Members - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); - #endregion - - #region Object Members - String ToString(); - bool Equals(Object other); - int GetHashCode(); - Type GetType(); - #endregion - - #region MemberInfo Members - MemberTypes MemberType { get; } - String Name { get; } - Type DeclaringType { get; } - Type ReflectedType { get; } - Object[] GetCustomAttributes(Type attributeType, bool inherit); - Object[] GetCustomAttributes(bool inherit); - bool IsDefined(Type attributeType, bool inherit); - #endregion - - #region EventInfo Members - MethodInfo GetAddMethod(bool nonPublic); - MethodInfo GetRemoveMethod(bool nonPublic); - MethodInfo GetRaiseMethod(bool nonPublic); - EventAttributes Attributes { get; } - MethodInfo GetAddMethod(); - MethodInfo GetRemoveMethod(); - MethodInfo GetRaiseMethod(); - void AddEventHandler(Object target, Delegate handler); - void RemoveEventHandler(Object target, Delegate handler); - Type EventHandlerType { get; } - bool IsSpecialName { get; } - bool IsMulticast { get; } - #endregion -#endif } [GuidAttribute("993634C4-E47A-32CC-BE08-85F567DC27D6")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.ParameterInfo))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _ParameterInfo { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("D002E9BA-D9E3-3749-B1D3-D565A08B13E7")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Module))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _Module { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("B42B6AAC-317E-34D5-9FA9-093BB4160C50")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.AssemblyName))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _AssemblyName { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs index ee9cf8a..3d927fc 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs @@ -95,57 +95,6 @@ namespace System.Reflection return Invoke(BindingFlags.Default, null, parameters, null); } #endregion - -#if !FEATURE_CORECLR - #region COM Interop Support - Type _ConstructorInfo.GetType() - { - return base.GetType(); - } - - Object _ConstructorInfo.Invoke_2(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) - { - return Invoke(obj, invokeAttr, binder, parameters, culture); - } - - Object _ConstructorInfo.Invoke_3(Object obj, Object[] parameters) - { - return Invoke(obj, parameters); - } - - Object _ConstructorInfo.Invoke_4(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) - { - return Invoke(invokeAttr, binder, parameters, culture); - } - - Object _ConstructorInfo.Invoke_5(Object[] parameters) - { - return Invoke(parameters); - } - - void _ConstructorInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _ConstructorInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _ConstructorInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _ConstructorInfo.Invoke in VM\DangerousAPIs.h and - // include _ConstructorInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _ConstructorInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } - #endregion -#endif } [Serializable] @@ -563,27 +512,11 @@ namespace System.Reflection if (obj != null) { - -#if FEATURE_CORECLR // For unverifiable code, we require the caller to be critical. // Adding the INVOCATION_FLAGS_NEED_SECURITY flag makes that check happen invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY; -#else // FEATURE_CORECLR - new SecurityPermission(SecurityPermissionFlag.SkipVerification).Demand(); -#endif // FEATURE_CORECLR - } -#if !FEATURE_CORECLR - if ((invocationFlags &(INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0) - { - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) - CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) - RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags); - } -#endif // !FEATURE_CORECLR - Signature sig = Signature; // get the signature @@ -619,29 +552,17 @@ namespace System.Reflection public override bool IsSecurityCritical { -#if FEATURE_CORECLR get { return true; } -#else - get { return RuntimeMethodHandle.IsSecurityCritical(this); } -#endif } public override bool IsSecuritySafeCritical { -#if FEATURE_CORECLR get { return false; } -#else - get { return RuntimeMethodHandle.IsSecuritySafeCritical(this); } -#endif } public override bool IsSecurityTransparent { -#if FEATURE_CORECLR get { return false; } -#else - get { return RuntimeMethodHandle.IsSecurityTransparent(this); } -#endif } public override bool ContainsGenericParameters @@ -677,18 +598,6 @@ namespace System.Reflection } #endif -#if !FEATURE_CORECLR - if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY | INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR)) != 0) - { - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) - CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) - RuntimeMethodHandle.PerformSecurityCheck(null, this, m_declaringType, (uint)(m_invocationFlags | INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE)); - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR) != 0) - new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); - } -#endif // !FEATURE_CORECLR - // get the signature Signature sig = Signature; @@ -742,5 +651,4 @@ namespace System.Reflection } #endregion } - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs b/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs index ff131bf..b27430d 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/CustomAttribute.cs @@ -1370,16 +1370,7 @@ namespace System.Reflection private static bool SpecialAllowCriticalAttributes(RuntimeType type) { - // Types participating in Type Equivalence are always transparent. - // See TokenSecurityDescriptor::VerifySemanticDataComputed in securitymeta.cpp. - // Because of that we allow critical attributes applied to full trust equivalent types. - // DeclaringType is null for global methods and fields and the global type never participates in type equivalency. - -#if FEATURE_CORECLR return false; -#else - return type != null && type.Assembly.IsFullyTrusted && RuntimeTypeHandle.IsEquivalentType(type); -#endif //!FEATURE_CORECLR } private static bool AllowCriticalCustomAttributes(MethodBase method) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs index bd3de8c..41c1d31 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -171,24 +171,6 @@ namespace System.Reflection.Emit return AssemblyBuilder.GetInMemoryAssemblyModule(GetNativeHandle()); } -#if !FEATURE_CORECLR - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern RuntimeModule GetOnDiskAssemblyModule(RuntimeAssembly assembly); - - private ModuleBuilder GetOnDiskAssemblyModuleBuilder() - { - if (m_onDiskAssemblyModuleBuilder == null) - { - Module module = AssemblyBuilder.GetOnDiskAssemblyModule(InternalAssembly.GetNativeHandle()); - ModuleBuilder modBuilder = new ModuleBuilder(this, (InternalModuleBuilder)module); - modBuilder.Init("RefEmit_OnDiskManifestModule", null, 0); - m_onDiskAssemblyModuleBuilder = modBuilder; - } - - return m_onDiskAssemblyModuleBuilder; - } -#endif // FEATURE_CORECLR - #endregion #region Internal Data Members @@ -199,9 +181,6 @@ namespace System.Reflection.Emit // Set to true if the manifest module was returned by code:DefineDynamicModule to the user private bool m_fManifestModuleUsedAsDefinedModule; internal const string MANIFEST_MODULE_NAME = "RefEmit_InMemoryManifestModule"; -#if !FEATURE_CORECLR - private ModuleBuilder m_onDiskAssemblyModuleBuilder; -#endif // !FEATURE_CORECLR #if FEATURE_APPX private bool m_profileAPICheck; @@ -214,18 +193,6 @@ namespace System.Reflection.Emit lock(SyncRoot) { -#if !FEATURE_CORECLR - foreach (ModuleBuilder modBuilder in m_assemblyData.m_moduleBuilderList) - { - if (modBuilder.InternalModule == module) - return modBuilder; - } - - // m_onDiskAssemblyModuleBuilder is null before Save - if (m_onDiskAssemblyModuleBuilder != null && m_onDiskAssemblyModuleBuilder.InternalModule == module) - return m_onDiskAssemblyModuleBuilder; -#endif // !FEATURE_CORECLR - // in CoreCLR there is only one module in each dynamic assembly, the manifest module if (m_manifestModuleBuilder.InternalModule == module) return m_manifestModuleBuilder; @@ -288,10 +255,6 @@ namespace System.Reflection.Emit throw new ArgumentNullException(nameof(name)); if (access != AssemblyBuilderAccess.Run -#if !FEATURE_CORECLR - && access != AssemblyBuilderAccess.Save - && access != AssemblyBuilderAccess.RunAndSave -#endif // !FEATURE_CORECLR #if FEATURE_REFLECTION_ONLY_LOAD && access != AssemblyBuilderAccess.ReflectionOnly #endif // FEATURE_REFLECTION_ONLY_LOAD @@ -311,14 +274,6 @@ namespace System.Reflection.Emit // Clone the name in case the caller modifies it underneath us. name = (AssemblyName)name.Clone(); - -#if !FEATURE_CORECLR - // Set the public key from the key pair if one has been provided. - // (Overwite any public key in the Assembly name, since it's no - // longer valid to have a disparity). - if (name.KeyPair != null) - name.SetPublicKey(name.KeyPair.PublicKey); -#endif // If the caller is trusted they can supply identity // evidence for the new assembly. Otherwise we copy the @@ -332,13 +287,6 @@ namespace System.Reflection.Emit new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand(); #pragma warning restore 618 -#if FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR - // Collectible assemblies require FullTrust. This demand may be removed if we deem the - // feature robust enough to be used directly by untrusted API consumers. - if (access == AssemblyBuilderAccess.RunAndCollect) - new PermissionSet(PermissionState.Unrestricted).Demand(); -#endif // FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR - // Scan the assembly level attributes for any attributes which modify how we create the // assembly. Currently, we look for any attribute which modifies the security transparency // of the assembly. @@ -660,162 +608,6 @@ namespace System.Reflection.Emit } } -#if !FEATURE_CORECLR - /********************************************** - * - * Define stand alone managed resource for Assembly - * - **********************************************/ - public IResourceWriter DefineResource( - String name, - String description, - String fileName) - { - return DefineResource(name, description, fileName, ResourceAttributes.Public); - } - - /********************************************** - * - * Define stand alone managed resource for Assembly - * - **********************************************/ - public IResourceWriter DefineResource( - String name, - String description, - String fileName, - ResourceAttributes attribute) - { - lock(SyncRoot) - { - return DefineResourceNoLock(name, description, fileName, attribute); - } - } - - private IResourceWriter DefineResourceNoLock( - String name, - String description, - String fileName, - ResourceAttributes attribute) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (name.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name); - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - if (fileName.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), nameof(fileName)); - if (!String.Equals(fileName, Path.GetFileName(fileName))) - throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), nameof(fileName)); - Contract.EndContractBlock(); - - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.DefineResource( " + name + ", " + fileName + ")"); - - m_assemblyData.CheckResNameConflict(name); - m_assemblyData.CheckFileNameConflict(fileName); - - ResourceWriter resWriter; - String fullFileName; - - if (m_assemblyData.m_strDir == null) - { - // If assembly directory is null, use current directory - fullFileName = Path.Combine(Directory.GetCurrentDirectory(), fileName); - resWriter = new ResourceWriter(fullFileName); - } - else - { - // Form the full path given the directory provided by user - fullFileName = Path.Combine(m_assemblyData.m_strDir, fileName); - resWriter = new ResourceWriter(fullFileName); - } - // get the full path - fullFileName = Path.GetFullPath(fullFileName); - - // retrieve just the file name - fileName = Path.GetFileName(fullFileName); - - m_assemblyData.AddResWriter( new ResWriterData( resWriter, null, name, fileName, fullFileName, attribute) ); - return resWriter; - } - - /********************************************** - * - * Add an existing resource file to the Assembly - * - **********************************************/ - public void AddResourceFile( - String name, - String fileName) - { - AddResourceFile(name, fileName, ResourceAttributes.Public); - } - - /********************************************** - * - * Add an existing resource file to the Assembly - * - **********************************************/ - public void AddResourceFile( - String name, - String fileName, - ResourceAttributes attribute) - { - lock(SyncRoot) - { - AddResourceFileNoLock(name, fileName, attribute); - } - } - - private void AddResourceFileNoLock( - String name, - String fileName, - ResourceAttributes attribute) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (name.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name); - if (fileName == null) - throw new ArgumentNullException(nameof(fileName)); - if (fileName.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), fileName); - if (!String.Equals(fileName, Path.GetFileName(fileName))) - throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), nameof(fileName)); - Contract.EndContractBlock(); - - BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.AddResourceFile( " + name + ", " + fileName + ")"); - - m_assemblyData.CheckResNameConflict(name); - m_assemblyData.CheckFileNameConflict(fileName); - - String fullFileName; - - if (m_assemblyData.m_strDir == null) - { - // If assembly directory is null, use current directory - fullFileName = Path.Combine(Directory.GetCurrentDirectory(), fileName); - } - else - { - // Form the full path given the directory provided by user - fullFileName = Path.Combine(m_assemblyData.m_strDir, fileName); - } - - // get the full path - fullFileName = Path.UnsafeGetFullPath(fullFileName); - - // retrieve just the file name - fileName = Path.GetFileName(fullFileName); - - if (File.UnsafeExists(fullFileName) == false) - throw new FileNotFoundException(Environment.GetResourceString( - "IO.FileNotFound_FileName", - fileName), fileName); - m_assemblyData.AddResWriter( new ResWriterData( null, null, name, fileName, fullFileName, attribute) ); - } -#endif // !FEATURE_CORECLR - #region object overrides public override bool Equals(object obj) { @@ -1013,140 +805,6 @@ namespace System.Reflection.Emit #endregion -#if !FEATURE_CORECLR - /********************************************** - * - * Add an unmanaged Version resource to the - * assembly - * - **********************************************/ - public void DefineVersionInfoResource( - String product, - String productVersion, - String company, - String copyright, - String trademark) - { - lock(SyncRoot) - { - DefineVersionInfoResourceNoLock( - product, - productVersion, - company, - copyright, - trademark); - } - } - - private void DefineVersionInfoResourceNoLock( - String product, - String productVersion, - String company, - String copyright, - String trademark) - { - if (m_assemblyData.m_strResourceFileName != null || - m_assemblyData.m_resourceBytes != null || - m_assemblyData.m_nativeVersion != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - m_assemblyData.m_nativeVersion = new NativeVersionInfo(); - - m_assemblyData.m_nativeVersion.m_strCopyright = copyright; - m_assemblyData.m_nativeVersion.m_strTrademark = trademark; - m_assemblyData.m_nativeVersion.m_strCompany = company; - m_assemblyData.m_nativeVersion.m_strProduct = product; - m_assemblyData.m_nativeVersion.m_strProductVersion = productVersion; - m_assemblyData.m_hasUnmanagedVersionInfo = true; - m_assemblyData.m_OverrideUnmanagedVersionInfo = true; - - } - - public void DefineVersionInfoResource() - { - lock(SyncRoot) - { - DefineVersionInfoResourceNoLock(); - } - } - - private void DefineVersionInfoResourceNoLock() - { - if (m_assemblyData.m_strResourceFileName != null || - m_assemblyData.m_resourceBytes != null || - m_assemblyData.m_nativeVersion != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - m_assemblyData.m_hasUnmanagedVersionInfo = true; - m_assemblyData.m_nativeVersion = new NativeVersionInfo(); - } - - public void DefineUnmanagedResource(Byte[] resource) - { - if (resource == null) - throw new ArgumentNullException(nameof(resource)); - Contract.EndContractBlock(); - - lock(SyncRoot) - { - DefineUnmanagedResourceNoLock(resource); - } - } - - private void DefineUnmanagedResourceNoLock(Byte[] resource) - { - if (m_assemblyData.m_strResourceFileName != null || - m_assemblyData.m_resourceBytes != null || - m_assemblyData.m_nativeVersion != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - m_assemblyData.m_resourceBytes = new byte[resource.Length]; - Buffer.BlockCopy(resource, 0, m_assemblyData.m_resourceBytes, 0, resource.Length); - } - - public void DefineUnmanagedResource(String resourceFileName) - { - if (resourceFileName == null) - throw new ArgumentNullException(nameof(resourceFileName)); - Contract.EndContractBlock(); - - lock(SyncRoot) - { - DefineUnmanagedResourceNoLock(resourceFileName); - } - } - - private void DefineUnmanagedResourceNoLock(String resourceFileName) - { - if (m_assemblyData.m_strResourceFileName != null || - m_assemblyData.m_resourceBytes != null || - m_assemblyData.m_nativeVersion != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - // Check caller has the right to read the file. - string strFullFileName; - if (m_assemblyData.m_strDir == null) - { - // If assembly directory is null, use current directory - strFullFileName = Path.Combine(Directory.GetCurrentDirectory(), resourceFileName); - } - else - { - // Form the full path given the directory provided by user - strFullFileName = Path.Combine(m_assemblyData.m_strDir, resourceFileName); - } - strFullFileName = Path.GetFullPath(resourceFileName); - new FileIOPermission(FileIOPermissionAccess.Read, strFullFileName).Demand(); - - if (File.Exists(strFullFileName) == false) - throw new FileNotFoundException(Environment.GetResourceString( - "IO.FileNotFound_FileName", - resourceFileName), resourceFileName); - m_assemblyData.m_strResourceFileName = strFullFileName; - } -#endif // !FEATURE_CORECLR - - /********************************************** * * return a dynamic module with the specified name. @@ -1221,18 +879,6 @@ namespace System.Reflection.Emit m_assemblyData.m_entryPointMethod = entryMethod; m_assemblyData.m_peFileKind = fileKind; - -#if !FEATURE_CORECLR - // Setting the entry point - ModuleBuilder tmpMB = tmpModule as ModuleBuilder; - if (tmpMB != null) - m_assemblyData.m_entryPointModule = tmpMB; - else - m_assemblyData.m_entryPointModule = GetModuleBuilder((InternalModuleBuilder)tmpModule); - - MethodToken entryMethodToken = m_assemblyData.m_entryPointModule.GetMethodToken(entryMethod); - m_assemblyData.m_entryPointModule.SetEntryPoint(entryMethodToken); -#endif //!FEATURE_CORECLR } @@ -1330,7 +976,7 @@ namespace System.Reflection.Emit private void SaveNoLock(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) { - // AssemblyBuilderAccess.Save can never be set with FEATURE_CORECLR + // AssemblyBuilderAccess.Save can never be set in CoreCLR throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantSaveTransientAssembly")); } @@ -1386,30 +1032,6 @@ namespace System.Reflection.Emit **********************************************/ private AssemblyBuilder() {} -#if !FEATURE_CORECLR - void _AssemblyBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _AssemblyBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _AssemblyBuilder.Invoke in VM\DangerousAPIs.h and - // include _AssemblyBuilder in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _AssemblyBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - // Create a new module in which to emit code. This module will not contain the manifest. [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs index 00a961d..5c86d8e 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs @@ -8,17 +8,13 @@ using System; // EE uses these enum values..look for m_dwDynamicAssemblyAccess in Assembly.hpp namespace System.Reflection.Emit -{ +{ [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [Flags] public enum AssemblyBuilderAccess { Run = 1, -#if !FEATURE_CORECLR // these are unsupported - Save = 2, - RunAndSave = Run | Save, -#endif // !FEATURE_CORECLR #if FEATURE_REFLECTION_ONLY_LOAD ReflectionOnly = 6, // 4 | Save, #endif // FEATURE_REFLECTION_ONLY_LOAD diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs index 3d08dc0..f0f83e7 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -14,11 +14,7 @@ namespace System.Reflection.Emit { using System.Security; using System.Diagnostics; using CultureInfo = System.Globalization.CultureInfo; -#if !FEATURE_CORECLR - using ResourceWriter = System.Resources.ResourceWriter; -#else // FEATURE_CORECLR using IResourceWriter = System.Resources.IResourceWriter; -#endif // !FEATURE_CORECLR using System.IO; using System.Runtime.Versioning; using System.Diagnostics.SymbolStore; @@ -467,7 +463,7 @@ namespace System.Reflection.Emit { // hard coding the assembly def token internal const int m_tkAssembly = 0x20000001; - + // Security permission requests internal PermissionSet m_RequiredPset; internal PermissionSet m_OptionalPset; @@ -483,10 +479,6 @@ namespace System.Reflection.Emit { internal MethodInfo m_entryPointMethod; internal Assembly m_ISymWrapperAssembly; -#if !FEATURE_CORECLR - internal ModuleBuilder m_entryPointModule; -#endif //!FEATURE_CORECLR - // For unmanaged resources internal String m_strResourceFileName; internal byte[] m_resourceBytes; @@ -505,7 +497,6 @@ namespace System.Reflection.Emit { **********************************************/ internal class ResWriterData { -#if FEATURE_CORECLR internal ResWriterData( IResourceWriter resWriter, Stream memoryStream, @@ -522,29 +513,8 @@ namespace System.Reflection.Emit { m_nextResWriter = null; m_attribute = attribute; } -#else - internal ResWriterData( - ResourceWriter resWriter, - Stream memoryStream, - String strName, - String strFileName, - String strFullFileName, - ResourceAttributes attribute) - { - m_resWriter = resWriter; - m_memoryStream = memoryStream; - m_strName = strName; - m_strFileName = strFileName; - m_strFullFileName = strFullFileName; - m_nextResWriter = null; - m_attribute = attribute; - } -#endif -#if !FEATURE_CORECLR - internal ResourceWriter m_resWriter; -#else // FEATURE_CORECLR - internal IResourceWriter m_resWriter; -#endif // !FEATURE_CORECLR + + internal IResourceWriter m_resWriter; internal String m_strName; internal String m_strFileName; internal String m_strFullFileName; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs index 0d8ce5a..8dba934 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs @@ -2,33 +2,15 @@ // 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.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Security.Permissions; -using System.Security.Policy; - namespace System.Runtime.InteropServices { [GuidAttribute("BEBB2505-8B54-3443-AEAD-142A16DD9CC7")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _AssemblyBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("ED3E4384-D7E2-3FA7-8FFD-8940D330519A")] @@ -38,141 +20,69 @@ namespace System.Runtime.InteropServices [System.Runtime.InteropServices.ComVisible(true)] public interface _ConstructorBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("BE9ACCE8-AAFF-3B91-81AE-8211663F5CAD")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _CustomAttributeBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("C7BD73DE-9F85-3290-88EE-090B8BDFE2DF")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.EnumBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _EnumBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("AADABA99-895D-3D65-9760-B1F12621FAE8")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.EventBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _EventBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("CE1A3BF5-975E-30CC-97C9-1EF70F8F3993")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.FieldBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _FieldBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("A4924B27-6E3B-37F7-9B83-A4501955E6A7")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ILGenerator))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _ILGenerator { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("4E6350D1-A08B-3DEC-9A3E-C465F9AEEC0C")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.LocalBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _LocalBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("007D8A14-FDF3-363E-9A0B-FEC0618260A2")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.MethodBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _MethodBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } #if FEATURE_METHOD_RENTAL @@ -180,18 +90,9 @@ namespace System.Runtime.InteropServices [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.MethodRental))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _MethodRental { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } #endif @@ -199,90 +100,44 @@ namespace System.Runtime.InteropServices [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ModuleBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _ModuleBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("36329EBA-F97A-3565-BC07-0ED5C6EF19FC")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ParameterBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _ParameterBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("15F9A479-9397-3A63-ACBD-F51977FB0F02")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.PropertyBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _PropertyBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("7D13DD37-5A04-393C-BBCA-A5FEA802893D")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.SignatureHelper))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _SignatureHelper { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } [GuidAttribute("7E5678EE-48B3-3F83-B076-C58543498A58")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] [TypeLibImportClassAttribute(typeof(System.Reflection.Emit.TypeBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _TypeBuilder { -#if !FEATURE_CORECLR - void GetTypeInfoCount(out uint pcTInfo); - - void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo); - - void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId); - - void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr); -#endif } - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs index 37faaf2..a4df0e9 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs @@ -270,28 +270,6 @@ namespace System.Reflection.Emit } #endregion - -#if !FEATURE_CORECLR - void _ConstructorBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _ConstructorBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _ConstructorBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _ConstructorBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs index c7ae930..ecbb811 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs @@ -576,28 +576,6 @@ namespace System.Reflection.Emit { typeof(System.Diagnostics.DebuggableAttribute) == m_con.DeclaringType); } -#if !FEATURE_CORECLR - void _CustomAttributeBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _CustomAttributeBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _CustomAttributeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _CustomAttributeBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - internal ConstructorInfo m_con; internal Object[] m_constructorArgs; internal byte[] m_blob; diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs index dbea8de..94f65fc 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs @@ -266,21 +266,6 @@ namespace System.Reflection.Emit CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, EmptyArray.Value); List assemblyAttributes = new List(); assemblyAttributes.Add(transparencyAttribute); -#if !FEATURE_CORECLR - // On the desktop, we need to use the security rule set level 1 for anonymously hosted - // dynamic methods. In level 2, transparency rules are strictly enforced, which leads to - // errors when a fully trusted application causes a dynamic method to be generated that tries - // to call a method with a LinkDemand or a SecurityCritical method. To retain compatibility - // with the v2.0 and v3.x frameworks, these calls should be allowed. - // - // If this rule set was not explicitly called out, then the anonymously hosted dynamic methods - // assembly would inherit the rule set from the creating assembly - which would cause it to - // be level 2 because mscorlib.dll is using the level 2 rules. - ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) }); - CustomAttributeBuilder securityRulesAttribute = - new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level1 }); - assemblyAttributes.Add(securityRulesAttribute); -#endif // !FEATURE_CORECLR AssemblyName assemblyName = new AssemblyName("Anonymously Hosted DynamicMethods Assembly"); StackCrawlMark stackMark = StackCrawlMark.LookForMe; @@ -403,87 +388,12 @@ namespace System.Reflection.Emit if (m == null) throw new ArgumentNullException(nameof(m)); Contract.EndContractBlock(); -#if !FEATURE_CORECLR - - RuntimeModule rtModule; - ModuleBuilder mb = m as ModuleBuilder; - if (mb != null) - rtModule = mb.InternalModule; - else - rtModule = m as RuntimeModule; - - if (rtModule == null) - { - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeModule"), nameof(m)); - } - - // The user cannot explicitly use this assembly - if (rtModule == s_anonymouslyHostedDynamicMethodsModule) - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidValue"), nameof(m)); - - // ask for member access if skip visibility - if (skipVisibility) - new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand(); - -#if !FEATURE_CORECLR - // ask for control evidence if outside of the caller assembly - RuntimeType callingType = RuntimeMethodHandle.GetCallerType(ref stackMark); - m_creatorAssembly = callingType.GetRuntimeAssembly(); - if (m.Assembly != m_creatorAssembly) - { - // Demand the permissions of the assembly where the DynamicMethod will live - CodeAccessSecurityEngine.ReflectionTargetDemandHelper(PermissionType.SecurityControlEvidence, - m.Assembly.PermissionSet); - } -#else //FEATURE_CORECLR -#pragma warning disable 618 - new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand(); -#pragma warning restore 618 -#endif //FEATURE_CORECLR -#endif //!FEATURE_CORECLR } private void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility) { if (owner == null) throw new ArgumentNullException(nameof(owner)); -#if !FEATURE_CORECLR - - RuntimeType rtOwner = owner as RuntimeType; - if (rtOwner == null) - rtOwner = owner.UnderlyingSystemType as RuntimeType; - - if (rtOwner == null) - throw new ArgumentNullException(nameof(owner), Environment.GetResourceString("Argument_MustBeRuntimeType")); - - // get the type the call is coming from - RuntimeType callingType = RuntimeMethodHandle.GetCallerType(ref stackMark); - - // ask for member access if skip visibility - if (skipVisibility) - new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand(); - else - { - // if the call is not coming from the same class ask for member access - if (callingType != rtOwner) - new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand(); - } -#if !FEATURE_CORECLR - m_creatorAssembly = callingType.GetRuntimeAssembly(); - - // ask for control evidence if outside of the caller module - if (rtOwner.Assembly != m_creatorAssembly) - { - // Demand the permissions of the assembly where the DynamicMethod will live - CodeAccessSecurityEngine.ReflectionTargetDemandHelper(PermissionType.SecurityControlEvidence, - owner.Assembly.PermissionSet); - } -#else //FEATURE_CORECLR -#pragma warning disable 618 - new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand(); -#pragma warning restore 618 -#endif //FEATURE_CORECLR -#endif //!FEATURE_CORECLR } // @@ -594,89 +504,17 @@ namespace System.Reflection.Emit public override bool IsSecurityCritical { -#if FEATURE_CORECLR get { return true; } -#else - get - { - if (m_methodHandle != null) - { - return RuntimeMethodHandle.IsSecurityCritical(m_methodHandle); - } - else if (m_typeOwner != null) - { - RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return assembly.IsAllSecurityCritical(); - } - else - { - RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return assembly.IsAllSecurityCritical(); - } - } -#endif } public override bool IsSecuritySafeCritical { -#if FEATURE_CORECLR get { return false; } -#else - get - { - if (m_methodHandle != null) - { - return RuntimeMethodHandle.IsSecuritySafeCritical(m_methodHandle); - } - else if (m_typeOwner != null) - { - RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return assembly.IsAllPublicAreaSecuritySafeCritical(); - } - else - { - RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return assembly.IsAllSecuritySafeCritical(); - } - } -#endif } public override bool IsSecurityTransparent { -#if FEATURE_CORECLR get { return false; } -#else - get - { - if (m_methodHandle != null) - { - return RuntimeMethodHandle.IsSecurityTransparent(m_methodHandle); - } - else if (m_typeOwner != null) - { - RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return !assembly.IsAllSecurityCritical(); - } - else - { - RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly; - Contract.Assert(assembly != null); - - return !assembly.IsAllSecurityCritical(); - } - } -#endif } public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs index 53989ba..0550886 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs @@ -410,29 +410,6 @@ namespace System.Reflection.Emit { m_underlyingField = m_typeBuilder.DefineField("value__", underlyingType, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName); } -#if !FEATURE_CORECLR - void _EnumBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _EnumBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _EnumBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _EnumBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - - /***************************************************** * * private data members diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs index b9ffaff..0315280 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs @@ -126,29 +126,6 @@ namespace System.Reflection.Emit { customBuilder.CreateCustomAttribute(m_module, m_evToken.Token); } -#if !FEATURE_CORECLR - void _EventBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _EventBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _EventBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _EventBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - - // These are package private so that TypeBuilder can access them. private String m_name; // The name of the event private EventToken m_evToken; // The token of this event @@ -156,8 +133,4 @@ namespace System.Reflection.Emit { private EventAttributes m_attributes; private TypeBuilder m_type; } - - - - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs index 965686c..1702c7c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs @@ -240,27 +240,5 @@ namespace System.Reflection.Emit } #endregion - -#if !FEATURE_CORECLR - void _FieldBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _FieldBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _FieldBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _FieldBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs index 396ffe8..5ed2173 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs @@ -1351,28 +1351,6 @@ namespace System.Reflection.Emit #endregion #endregion - -#if !FEATURE_CORECLR - void _ILGenerator.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _ILGenerator.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _ILGenerator.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _ILGenerator.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } internal struct __FixupData diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs index 425321c..a737895 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// - -#if FEATURE_CORECLR - namespace System.Reflection.Emit { using System; @@ -14,7 +10,6 @@ namespace System.Reflection.Emit using System.Runtime.CompilerServices; using System.Diagnostics.SymbolStore; - //----------------------------------------------------------------------------------- // On Telesto, we don't ship the ISymWrapper.dll assembly. However, ReflectionEmit // relies on that assembly to write out managed PDBs. @@ -693,11 +688,5 @@ namespace System.Reflection.Emit m_Release = (DRelease)(Marshal.GetDelegateForFunctionPointer(nGetDReleaseTarget(), typeof(DRelease))); m_Release((IntPtr)0); // make one call to make sure the delegate is fully prepped before we're in the critical finalizer situation. } - } // PunkSafeHandle - } //namespace System.Reflection.Emit - - -#endif //FEATURE_CORECLR - diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs index 4008703..a34d5ebe 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs @@ -124,28 +124,6 @@ namespace System.Reflection.Emit } } #endregion - -#if !FEATURE_CORECLR - void _LocalBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _LocalBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _LocalBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _LocalBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs index 226d71b..eda8546 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs @@ -21,7 +21,7 @@ namespace System.Reflection.Emit [HostProtection(MayLeakOnAbort = true)] [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_MethodBuilder))] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public sealed class MethodBuilder : MethodInfo, _MethodBuilder { #region Private Data Members @@ -595,29 +595,17 @@ namespace System.Reflection.Emit public override bool IsSecurityCritical { -#if FEATURE_CORECLR get { return true; } -#else - get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); } -#endif } public override bool IsSecuritySafeCritical { -#if FEATURE_CORECLR get { return false; } -#else - get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); } -#endif } public override bool IsSecurityTransparent { -#if FEATURE_CORECLR get { return false; } -#else - get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); } -#endif } #endregion @@ -1192,29 +1180,6 @@ namespace System.Reflection.Emit internal bool m_isDllImport = false; #endregion - -#if !FEATURE_CORECLR - void _MethodBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _MethodBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _MethodBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - } internal class LocalSymInfo diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs index 8659c46..7cfe625 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -97,9 +97,6 @@ namespace System.Reflection.Emit private Dictionary m_TypeBuilderDict; private ISymbolWriter m_iSymWriter; internal ModuleBuilderData m_moduleData; -#if !FEATURE_CORECLR - private MethodToken m_EntryPoint; -#endif //!FEATURE_CORECLR internal InternalModuleBuilder m_internalModuleBuilder; // This is the "external" AssemblyBuilder // only the "external" ModuleBuilder has this set @@ -329,101 +326,6 @@ namespace System.Reflection.Emit return null; } - -#if !FEATURE_CORECLR - internal void SetEntryPoint(MethodToken entryPoint) - { - // Sets the entry point of the module to be a given method. If no entry point - // is specified, calling EmitPEFile will generate a dll. - // AssemblyBuilder.SetEntryPoint has already demanded required permission - m_EntryPoint = entryPoint; - } -#endif //!FEATURE_CORECLR - - -#if !FEATURE_CORECLR - // This is a helper called by AssemblyBuilder save to presave information for the persistable modules. - // no need to lock here because we have already taken the lock in AssemblyBuilder.Save - internal void PreSave(String fileName, - PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) - { - if (m_moduleData.m_isSaved == true) - { - // can only save once - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, - Environment.GetResourceString("InvalidOperation_ModuleHasBeenSaved"), - m_moduleData.m_strModuleName)); - } - - if (m_moduleData.m_fGlobalBeenCreated == false && m_moduleData.m_fHasGlobal == true) - throw new NotSupportedException(Environment.GetResourceString("NotSupported_GlobalFunctionNotBaked")); - - TypeBuilder typeBuilder; - foreach (Type item in m_TypeBuilderDict.Values) - { - if (item is TypeBuilder) - { - typeBuilder = (TypeBuilder)item; - } - else - { - EnumBuilder enumBuilder = (EnumBuilder)item; - typeBuilder = enumBuilder.m_typeBuilder; - } - - if (!typeBuilder.IsCreated()) - { - // cannot save to PE file without creating all of the types first - throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture, - Environment.GetResourceString("NotSupported_NotAllTypesAreBaked"), - typeBuilder.FullName)); - } - } - - PreSavePEFile(GetNativeHandle(), (int)portableExecutableKind, (int)imageFileMachine); - } - - // no need to lock here because we have already taken the lock in AssemblyBuilder.Save - internal void Save(String fileName, bool isAssemblyFile, PortableExecutableKinds portableExecutableKind, - ImageFileMachine imageFileMachine) - { - // This is a helper called by AssemblyBuilder save to save information for the persistable modules. - if (m_moduleData.m_embeddedRes != null) - { - // There are embedded resources for this module - ResWriterData resWriter; - - // Add each resource content into the to be saved PE file - for (resWriter = m_moduleData.m_embeddedRes; resWriter != null; resWriter = resWriter.m_nextResWriter) - { - if (resWriter.m_resWriter != null) - resWriter.m_resWriter.Generate(); - - byte[] resBytes = new byte[resWriter.m_memoryStream.Length]; - resWriter.m_memoryStream.Flush(); - resWriter.m_memoryStream.Position = 0; - resWriter.m_memoryStream.Read(resBytes, 0, resBytes.Length); - - AddResource(GetNativeHandle(), - resWriter.m_strName, - resBytes, - resBytes.Length, - m_moduleData.FileToken, - (int)resWriter.m_attribute, - (int)portableExecutableKind, - (int)imageFileMachine); - } - } - - DefineNativeResource(portableExecutableKind, imageFileMachine); - - PEFileKinds pekind = isAssemblyFile ? ContainingAssemblyBuilder.m_assemblyData.m_peFileKind : PEFileKinds.Dll; - - SavePEFile(GetNativeHandle(), fileName, m_EntryPoint.Token, (int)pekind, isAssemblyFile); - - m_moduleData.m_isSaved = true; - } -#endif // !FEATURE_CORECLR private int GetTypeRefNested(Type type, Module refedModule, String strRefedModuleFileName) { @@ -1179,164 +1081,7 @@ namespace System.Reflection.Emit #endregion #region Define Resource -#if !FEATURE_CORECLR - public IResourceWriter DefineResource(String name, String description) - { - // Define embedded managed resource to be stored in this module - Contract.Ensures(Contract.Result() != null); - - return DefineResource(name, description, ResourceAttributes.Public); - } - - public IResourceWriter DefineResource(String name, String description, ResourceAttributes attribute) - { - // Define embedded managed resource to be stored in this module - Contract.Ensures(Contract.Result() != null); - - lock(SyncRoot) - { - return DefineResourceNoLock(name, description, attribute); - } - } - - private IResourceWriter DefineResourceNoLock(String name, String description, ResourceAttributes attribute) - { - // Define embedded managed resource to be stored in this module - - if (IsTransient()) - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer")); - - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (name.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name)); - Contract.Ensures(Contract.Result() != null); - Contract.EndContractBlock(); - - if (m_assemblyBuilder.IsPersistable()) - { - m_assemblyBuilder.m_assemblyData.CheckResNameConflict(name); - - MemoryStream stream = new MemoryStream(); - ResourceWriter resWriter = new ResourceWriter(stream); - ResWriterData resWriterData = new ResWriterData( resWriter, stream, name, String.Empty, String.Empty, attribute); - - // chain it to the embedded resource list - resWriterData.m_nextResWriter = m_moduleData.m_embeddedRes; - m_moduleData.m_embeddedRes = resWriterData; - return resWriter; - } - else - { - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer")); - } - } - - public void DefineManifestResource(String name, Stream stream, ResourceAttributes attribute) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - Contract.EndContractBlock(); - - // Define embedded managed resource to be stored in this module - lock(SyncRoot) - { - DefineManifestResourceNoLock(name, stream, attribute); - } - } - - private void DefineManifestResourceNoLock(String name, Stream stream, ResourceAttributes attribute) - { - // Define embedded managed resource to be stored in this module - if (IsTransient()) - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer")); - Contract.EndContractBlock(); - - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (name.Length == 0) - throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name)); - - if (m_assemblyBuilder.IsPersistable()) - { - m_assemblyBuilder.m_assemblyData.CheckResNameConflict(name); - - ResWriterData resWriterData = new ResWriterData( null, stream, name, String.Empty, String.Empty, attribute); - - // chain it to the embedded resource list - resWriterData.m_nextResWriter = m_moduleData.m_embeddedRes; - m_moduleData.m_embeddedRes = resWriterData; - } - else - { - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer")); - } - } - - - public void DefineUnmanagedResource(Byte[] resource) - { - lock(SyncRoot) - { - DefineUnmanagedResourceInternalNoLock(resource); - } - } - - internal void DefineUnmanagedResourceInternalNoLock(Byte[] resource) - { - if (resource == null) - throw new ArgumentNullException(nameof(resource)); - Contract.EndContractBlock(); - - if (m_moduleData.m_strResourceFileName != null || m_moduleData.m_resourceBytes != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - m_moduleData.m_resourceBytes = new byte[resource.Length]; - Buffer.BlockCopy(resource, 0, m_moduleData.m_resourceBytes, 0, resource.Length); - } - - public void DefineUnmanagedResource(String resourceFileName) - { - lock(SyncRoot) - { - DefineUnmanagedResourceFileInternalNoLock(resourceFileName); - } - } - - internal void DefineUnmanagedResourceFileInternalNoLock(String resourceFileName) - { - if (resourceFileName == null) - throw new ArgumentNullException(nameof(resourceFileName)); - Contract.EndContractBlock(); - - if (m_moduleData.m_resourceBytes != null || m_moduleData.m_strResourceFileName != null) - throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined")); - - // Check caller has the right to read the file. - string strFullFileName; - strFullFileName = Path.UnsafeGetFullPath(resourceFileName); - new FileIOPermission(FileIOPermissionAccess.Read, strFullFileName).Demand(); - - new EnvironmentPermission(PermissionState.Unrestricted).Assert(); - try - { - if (File.UnsafeExists(resourceFileName) == false) - throw new FileNotFoundException(Environment.GetResourceString( - "IO.FileNotFound_FileName", - resourceFileName), resourceFileName); - } - finally - { - CodeAccessPermission.RevertAssert(); - } - - m_moduleData.m_strResourceFileName = strFullFileName; - } -#endif // !FEATURE_CORECLR #endregion #region Define Global Method @@ -1607,19 +1352,6 @@ namespace System.Reflection.Emit // ModuleBuilder refedModuleBuilder = refedModule as ModuleBuilder; -#if !FEATURE_CORECLR - Contract.Assert(refedModuleBuilder != null || refedModule is RuntimeModule); - bool isRefedModuleTransient = refedModuleBuilder != null ? - refedModuleBuilder.IsTransient() : - ((RuntimeModule)refedModule).IsTransientInternal(); - - // We cannot have a non-transient module referencing to a transient module. - if (IsTransient() == false && isRefedModuleTransient) - { - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadTransientModuleReference")); - } -#endif // !FEATURE_CORECLR - String strRefedModuleFileName = String.Empty; if (refedModule.Assembly.Equals(this.Assembly)) { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/Opcode.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/Opcode.cs index cae4f05..d7bfacd 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/Opcode.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/Opcode.cs @@ -36,7 +36,6 @@ public struct OpCode internal const int StackChangeShift = 28; // XXXX0000000000000000000000000000 -#if FEATURE_CORECLR private OpCodeValues m_value; private int m_flags; @@ -80,7 +79,6 @@ public struct OpCode } } - public StackBehaviour StackBehaviourPop { get @@ -112,121 +110,6 @@ public struct OpCode return (short)m_value; } } -#else // FEATURE_CORECLR - // - // The exact layout is part of the legacy COM mscorlib surface, so it is - // pretty much set in stone for desktop CLR. Ideally, we would use the packed - // bit field like for CoreCLR, but that would be a breaking change. - // - -// disable csharp compiler warning #0414: field assigned unused value -#pragma warning disable 0414 - private String m_stringname; // not used - computed lazily -#pragma warning restore 0414 - private StackBehaviour m_pop; - private StackBehaviour m_push; - private OperandType m_operand; - private OpCodeType m_type; - private int m_size; - private byte m_s1; - private byte m_s2; - private FlowControl m_ctrl; - - // Specifies whether the current instructions causes the control flow to - // change unconditionally. - private bool m_endsUncondJmpBlk; - - - // Specifies the stack change that the current instruction causes not - // taking into account the operand dependant stack changes. - private int m_stackChange; - - - internal OpCode(OpCodeValues value, int flags) - { - m_stringname = null; // computed lazily - m_pop = (StackBehaviour)((flags >> StackBehaviourPopShift) & StackBehaviourMask); - m_push = (StackBehaviour)((flags >> StackBehaviourPushShift) & StackBehaviourMask); - m_operand = (OperandType)(flags & OperandTypeMask); - m_type = (OpCodeType)((flags >> OpCodeTypeShift) & OpCodeTypeMask); - m_size = (flags >> SizeShift) & SizeMask; - m_s1 = (byte)((int)value >> 8); - m_s2 = (byte)(int)value; - m_ctrl = (FlowControl)((flags >> FlowControlShift) & FlowControlMask); - m_endsUncondJmpBlk = (flags & EndsUncondJmpBlkFlag) != 0; - m_stackChange = (flags >> StackChangeShift); - } - - internal bool EndsUncondJmpBlk() - { - return m_endsUncondJmpBlk; - } - - internal int StackChange() - { - return m_stackChange; - } - - public OperandType OperandType - { - get - { - return (m_operand); - } - } - - public FlowControl FlowControl - { - get - { - return (m_ctrl); - } - } - - public OpCodeType OpCodeType - { - get - { - return (m_type); - } - } - - - public StackBehaviour StackBehaviourPop - { - get - { - return (m_pop); - } - } - - public StackBehaviour StackBehaviourPush - { - get - { - return (m_push); - } - } - - public int Size - { - get - { - return (m_size); - } - } - - public short Value - { - get - { - if (m_size == 2) - return (short)(m_s1 << 8 | m_s2); - return (short)m_s2; - } - } -#endif // FEATURE_CORECLR - private static volatile string[] g_nameCache; @@ -308,5 +191,4 @@ public struct OpCode return Name; } } - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs index 88d7a5c..7909562 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs @@ -112,28 +112,6 @@ namespace System.Reflection.Emit { return m_pdToken; } -#if !FEATURE_CORECLR - void _ParameterBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _ParameterBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _ParameterBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _ParameterBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - internal int MetadataTokenInternal { get { return m_pdToken.Token; } } public virtual String Name { diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs index 26ed450..00de84c 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs @@ -245,28 +245,6 @@ namespace System.Reflection.Emit { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); } -#if !FEATURE_CORECLR - void _PropertyBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _PropertyBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _PropertyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _PropertyBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - public override String Name { get { return m_name; } } @@ -291,5 +269,4 @@ namespace System.Reflection.Emit { private MethodInfo m_setMethod; private TypeBuilder m_containingType; } - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs index f5a1ec3..a22df56 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs @@ -950,28 +950,6 @@ namespace System.Reflection.Emit #endregion -#if !FEATURE_CORECLR - void _SignatureHelper.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _SignatureHelper.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _SignatureHelper.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _SignatureHelper.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs index 3a4b359..8572637 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs @@ -654,25 +654,6 @@ namespace System.Reflection.Emit { if ((m_iPackingSize != 0) ||(m_iTypeSize != 0)) SetClassLayout(GetModuleBuilder().GetNativeHandle(), m_tdType.Token, m_iPackingSize, m_iTypeSize); -#if !FEATURE_CORECLR - // If the type is public and it is contained in a assemblyBuilder, - // update the public COMType list. - if (IsPublicComType(this)) - { - if (containingAssem.IsPersistable() && m_module.IsTransient() == false) - { - // This will throw InvalidOperationException if the assembly has been saved - // Ideally we should reject all emit operations if the assembly has been saved, - // but that would be a breaking change for some. Currently you cannot define - // modules and public types, but you can still define private types and global methods. - containingAssem.m_assemblyData.AddPublicComType(this); - } - - // Now add the type to the ExportedType table - if (!m_module.Equals(containingAssem.ManifestModule)) - containingAssem.DefineExportedTypeInMemory(this, m_module.m_moduleData.FileToken, m_tdType.Token); - } -#endif m_module.AddType(FullName, this); } @@ -1326,50 +1307,17 @@ namespace System.Reflection.Emit { public override bool IsSecurityCritical { -#if FEATURE_CORECLR get { return true; } -#else - get - { - if (!IsCreated()) - throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated")); - Contract.EndContractBlock(); - - return m_bakedRuntimeType.IsSecurityCritical; - } -#endif } public override bool IsSecuritySafeCritical { -#if FEATURE_CORECLR get { return false; } -#else - get - { - if (!IsCreated()) - throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated")); - Contract.EndContractBlock(); - - return m_bakedRuntimeType.IsSecuritySafeCritical; - } -#endif } public override bool IsSecurityTransparent { -#if FEATURE_CORECLR get { return false; } -#else - get - { - if (!IsCreated()) - throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated")); - Contract.EndContractBlock(); - - return m_bakedRuntimeType.IsSecurityTransparent; - } -#endif } [System.Runtime.InteropServices.ComVisible(true)] @@ -2453,27 +2401,5 @@ public TypeToken TypeToken #endregion #endregion - -#if !FEATURE_CORECLR - void _TypeBuilder.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _TypeBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _TypeBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs index 6064aea..d801bcb 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs @@ -187,35 +187,6 @@ namespace System.Reflection } } #endregion - -#if !FEATURE_CORECLR - Type _EventInfo.GetType() - { - return base.GetType(); - } - - void _EventInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _EventInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _EventInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _EventInfo.Invoke in VM\DangerousAPIs.h and - // include _EventInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _EventInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } [Serializable] diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs index 97a4815..e61207a 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs @@ -180,35 +180,6 @@ namespace System.Reflection } #endregion - -#if !FEATURE_CORECLR - Type _FieldInfo.GetType() - { - return base.GetType(); - } - - void _FieldInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _FieldInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _FieldInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _FieldInfo.Invoke in VM\DangerousAPIs.h and - // include _FieldInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _FieldInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } [Serializable] diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs index 26621cf..96a89ad 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MemberInfo.cs @@ -113,33 +113,5 @@ namespace System.Reflection { return base.GetHashCode(); } - -#if !FEATURE_CORECLR - // this method is required so Object.GetType is not made final virtual by the compiler - Type _MemberInfo.GetType() - { - return base.GetType(); - } - - void _MemberInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _MemberInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _MemberInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _MemberInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs index 4ffa135..644a1ac 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MethodBase.cs @@ -350,47 +350,5 @@ namespace System.Reflection return copyOfParameters; } #endregion - - #region _MethodBase Implementation -#if !FEATURE_CORECLR - Type _MethodBase.GetType() { return base.GetType(); } - bool _MethodBase.IsPublic { get { return IsPublic; } } - bool _MethodBase.IsPrivate { get { return IsPrivate; } } - bool _MethodBase.IsFamily { get { return IsFamily; } } - bool _MethodBase.IsAssembly { get { return IsAssembly; } } - bool _MethodBase.IsFamilyAndAssembly { get { return IsFamilyAndAssembly; } } - bool _MethodBase.IsFamilyOrAssembly { get { return IsFamilyOrAssembly; } } - bool _MethodBase.IsStatic { get { return IsStatic; } } - bool _MethodBase.IsFinal { get { return IsFinal; } } - bool _MethodBase.IsVirtual { get { return IsVirtual; } } - bool _MethodBase.IsHideBySig { get { return IsHideBySig; } } - bool _MethodBase.IsAbstract { get { return IsAbstract; } } - bool _MethodBase.IsSpecialName { get { return IsSpecialName; } } - bool _MethodBase.IsConstructor { get { return IsConstructor; } } - - void _MethodBase.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _MethodBase.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _MethodBase.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _MethodBase.Invoke in VM\DangerousAPIs.h and - // include _MethodBase in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _MethodBase.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - #endregion } - } diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs index 2f86b29..52d9d3a 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs @@ -85,35 +85,6 @@ namespace System.Reflection public virtual Delegate CreateDelegate(Type delegateType) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); } public virtual Delegate CreateDelegate(Type delegateType, Object target) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); } #endregion - -#if !FEATURE_CORECLR - Type _MethodInfo.GetType() - { - return base.GetType(); - } - - void _MethodInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _MethodInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _MethodInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _MethodInfo.Invoke in VM\DangerousAPIs.h and - // include _MethodInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _MethodInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } [Serializable] @@ -511,27 +482,15 @@ namespace System.Reflection public override bool IsSecurityCritical { -#if FEATURE_CORECLR get { return true; } -#else - get { return RuntimeMethodHandle.IsSecurityCritical(this); } -#endif } public override bool IsSecuritySafeCritical { -#if FEATURE_CORECLR get { return false; } -#else - get { return RuntimeMethodHandle.IsSecuritySafeCritical(this); } -#endif } public override bool IsSecurityTransparent { -#if FEATURE_CORECLR get { return false; } -#else - get { return RuntimeMethodHandle.IsSecurityTransparent(this); } -#endif } #endregion @@ -592,11 +551,6 @@ namespace System.Reflection } } -#if !FEATURE_CORECLR -#pragma warning disable 618 - [ReflectionPermissionAttribute(SecurityAction.Demand, Flags = ReflectionPermissionFlag.MemberAccess)] -#pragma warning restore 618 -#endif public override MethodBody GetMethodBody() { MethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal); @@ -678,17 +632,6 @@ namespace System.Reflection throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", FullName)); } #endif - -#if !FEATURE_CORECLR - if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0) - { - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0) - CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess); - - if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0) - RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags); - } -#endif // !FEATURE_CORECLR #endregion return UnsafeInvokeInternal(obj, parameters, arguments); diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs index d095b04..5d19bdc 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/ParameterInfo.cs @@ -177,28 +177,6 @@ namespace System.Reflection #region _ParameterInfo implementation -#if !FEATURE_CORECLR - void _ParameterInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _ParameterInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _ParameterInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _ParameterInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - #endregion #region IObjectReference diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs b/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs index ffeb5f5..79f838f 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs @@ -150,35 +150,6 @@ namespace System.Reflection public bool IsSpecialName { get { return(Attributes & PropertyAttributes.SpecialName) != 0; } } #endregion - -#if !FEATURE_CORECLR - Type _PropertyInfo.GetType() - { - return base.GetType(); - } - - void _PropertyInfo.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _PropertyInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _PropertyInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _PropertyInfo.Invoke in VM\DangerousAPIs.h and - // include _PropertyInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _PropertyInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif } [Serializable] diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs b/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs index 4b8ca82..8107cf4 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs @@ -26,9 +26,6 @@ namespace System.Reflection using System.Runtime.Versioning; using Microsoft.Win32; using System.Diagnostics.Contracts; -#if !FEATURE_CORECLR - using Microsoft.Runtime.Hosting; -#endif [Serializable] [System.Runtime.InteropServices.ComVisible(true)] @@ -73,83 +70,6 @@ namespace System.Reflection _publicKey = (byte[]) info.GetValue("_publicKey", typeof(byte[])); } -#if! FEATURE_CORECLR - // Reference key pair in named key container. - public StrongNameKeyPair(String keyPairContainer) - { - if (keyPairContainer == null) - throw new ArgumentNullException(nameof(keyPairContainer)); - Contract.EndContractBlock(); - - _keyPairContainer = keyPairContainer; - - _keyPairExported = false; - } - - // Get the public portion of the key pair. - public byte[] PublicKey - { - get - { - if (_publicKey == null) - { - _publicKey = ComputePublicKey(); - } - - byte[] publicKey = new byte[_publicKey.Length]; - Array.Copy(_publicKey, publicKey, _publicKey.Length); - - return publicKey; - } - } - - private unsafe byte[] ComputePublicKey() - { - byte[] publicKey = null; - - // Make sure pbPublicKey is not leaked with async exceptions - RuntimeHelpers.PrepareConstrainedRegions(); - try { - } - finally - { - IntPtr pbPublicKey = IntPtr.Zero; - int cbPublicKey = 0; - - try - { - bool result; - if (_keyPairExported) - { - result = StrongNameHelpers.StrongNameGetPublicKey(null, _keyPairArray, _keyPairArray.Length, - out pbPublicKey, out cbPublicKey); - } - else - { - result = StrongNameHelpers.StrongNameGetPublicKey(_keyPairContainer, null, 0, - out pbPublicKey, out cbPublicKey); - } - if (!result) - throw new ArgumentException(Environment.GetResourceString("Argument_StrongNameGetPublicKey")); - - publicKey = new byte[cbPublicKey]; - Buffer.Memcpy(publicKey, 0, (byte*)(pbPublicKey.ToPointer()), 0, cbPublicKey); - } - finally - { - if (pbPublicKey != IntPtr.Zero) - StrongNameHelpers.StrongNameFreeBuffer(pbPublicKey); - } - } - return publicKey; - } - // Internal routine used to retrieve key pair info from unmanaged code. - private bool GetKeyPair(out Object arrayOrContainer) - { - arrayOrContainer = _keyPairExported ? (Object)_keyPairArray : (Object)_keyPairContainer; - return _keyPairExported; - } -#else public StrongNameKeyPair(String keyPairContainer) { throw new PlatformNotSupportedException(); @@ -163,8 +83,6 @@ namespace System.Reflection } } -#endif// FEATURE_CORECLR - /// void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue("_keyPairExported", _keyPairExported); @@ -175,6 +93,5 @@ namespace System.Reflection /// void IDeserializationCallback.OnDeserialization (Object sender) {} - } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs b/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs index 6ea5590..eba471b 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs @@ -78,24 +78,6 @@ namespace System.Resources { } } -#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr - public bool HasNeutralResources(CultureInfo culture, String defaultResName) - { - // Detect missing neutral locale resources. - String defaultResPath = FindResourceFile(culture, defaultResName); - if (defaultResPath == null || !File.Exists(defaultResPath)) - { - String dir = _mediator.ModuleDir; - if (defaultResPath != null) - { - dir = Path.GetDirectoryName(defaultResPath); - } - return false; - } - return true; - } -#endif - // Given a CultureInfo, it generates the path &; file name for // the .resources file for that CultureInfo. This method will grovel // the disk looking for the correct file name & path. Uses CultureInfo's diff --git a/src/coreclr/src/mscorlib/src/System/Resources/IResourceGroveler.cs b/src/coreclr/src/mscorlib/src/System/Resources/IResourceGroveler.cs index 983fd12..77c5c95 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/IResourceGroveler.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/IResourceGroveler.cs @@ -23,10 +23,5 @@ namespace System.Resources { { ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark); - -#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr - - bool HasNeutralResources(CultureInfo culture, String defaultResName); -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs b/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs index 07b7271..b80b412 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs @@ -29,10 +29,6 @@ namespace System.Resources { using System.Diagnostics.Contracts; using Microsoft.Win32; -#if !FEATURE_CORECLR - using System.Diagnostics.Tracing; -#endif - // // Note: this type is integral to the construction of exception objects, // and sometimes this has to be done in low memory situtations (OOM) or @@ -109,43 +105,15 @@ namespace System.Resources { // want to add it twice. lock (localResourceSets) { - if (localResourceSets.TryGetValue(culture.Name, out rs)) - { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCacheUnexpected(_mediator.BaseName, _mediator.MainAssembly, culture.Name); - } -#endif - } + localResourceSets.TryGetValue(culture.Name, out rs); } stream = GetManifestResourceStream(satellite, fileName, ref stackMark); } -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - if (stream != null) - { - FrameworkEventSource.Log.ResourceManagerStreamFound(_mediator.BaseName, _mediator.MainAssembly, culture.Name, satellite, fileName); - } - else - { - FrameworkEventSource.Log.ResourceManagerStreamNotFound(_mediator.BaseName, _mediator.MainAssembly, culture.Name, satellite, fileName); - } - } -#endif - // 4a. Found a stream; create a ResourceSet if possible if (createIfNotExists && stream != null && rs == null) { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerCreatingResourceSet(_mediator.BaseName, _mediator.MainAssembly, culture.Name, fileName); - } -#endif rs = CreateResourceSet(stream, satellite); } else if (stream == null && tryParents) @@ -158,36 +126,9 @@ namespace System.Resources { } } -#if !FEATURE_CORECLR - if (!createIfNotExists && stream != null && rs == null) - { - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerNotCreatingResourceSet(_mediator.BaseName, _mediator.MainAssembly, culture.Name); - } - } -#endif - return rs; } -#if !FEATURE_CORECLR - // Returns whether or not the main assembly contains a particular resource - // file in it's assembly manifest. Used to verify that the neutral - // Culture's .resources file is present in the main assembly - public bool HasNeutralResources(CultureInfo culture, String defaultResName) - { - String resName = defaultResName; - if (_mediator.LocationInfo != null && _mediator.LocationInfo.Namespace != null) - resName = _mediator.LocationInfo.Namespace + Type.Delimiter + defaultResName; - String[] resourceFiles = _mediator.MainAssembly.GetManifestResourceNames(); - foreach(String s in resourceFiles) - if (s.Equals(resName)) - return true; - return false; - } -#endif - private CultureInfo UltimateFallbackFixup(CultureInfo lookForCulture) { @@ -198,13 +139,6 @@ namespace System.Resources { if (lookForCulture.Name == _mediator.NeutralResourcesCulture.Name && _mediator.FallbackLoc == UltimateResourceFallbackLocation.MainAssembly) { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerNeutralResourcesSufficient(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name); - } -#endif - returnCulture = CultureInfo.InvariantCulture; } else if (lookForCulture.HasInvariantCultureName && _mediator.FallbackLoc == UltimateResourceFallbackLocation.Satellite) @@ -213,7 +147,6 @@ namespace System.Resources { } return returnCulture; - } internal static CultureInfo GetNeutralResourcesLanguage(Assembly a, ref UltimateResourceFallbackLocation fallbackLocation) @@ -230,11 +163,6 @@ namespace System.Resources { fallbackLocation = (UltimateResourceFallbackLocation)fallback; } else { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) { - FrameworkEventSource.Log.ResourceManagerNeutralResourceAttributeMissing(a); - } -#endif fallbackLocation = UltimateResourceFallbackLocation.MainAssembly; return CultureInfo.InvariantCulture; } @@ -470,45 +398,17 @@ namespace System.Resources { } } -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - if (canonicalName != null) - { - FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName); - } - else - { - FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName); - } - } -#endif - if (canonicalName == null) { return null; } + // If we're looking in the main assembly AND if the main // assembly was the person who created the ResourceManager, // skip a security check for private manifest resources. bool canSkipSecurityCheck = _mediator.MainAssembly == satellite && _mediator.CallingAssembly == _mediator.MainAssembly; StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - Stream s = satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck); - // GetManifestResourceStream will return null if we don't have - // permission to read this stream from the assembly. For example, - // if the stream is private and we're trying to access it from another - // assembly (ie, ResMgr in mscorlib accessing anything else), we - // require Reflection TypeInformation permission to be able to read - // this. -#if !FEATURE_CORECLR - if (s!=null) { - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), canonicalName); - } - } -#endif - return s; + return satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck); } [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable @@ -552,20 +452,6 @@ namespace System.Resources { Contract.Assert(false, "[This assert catches satellite assembly build/deployment problems - report this message to your build lab & loc engineer]" + Environment.NewLine + "GetSatelliteAssembly failed for culture " + lookForCulture.Name + " and version " + (_mediator.SatelliteContractVersion == null ? _mediator.MainAssembly.GetVersion().ToString() : _mediator.SatelliteContractVersion.ToString()) + " of assembly " + _mediator.MainAssembly.GetSimpleName() + Environment.NewLine + "Exception: " + bife); } -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - if (satellite != null) - { - FrameworkEventSource.Log.ResourceManagerGetSatelliteAssemblySucceeded(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name, satAssemblyName); - } - else - { - FrameworkEventSource.Log.ResourceManagerGetSatelliteAssemblyFailed(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name, satAssemblyName); - } - } -#endif - return satellite; } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs index 30d50d9..de50ccc 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceFallbackManager.cs @@ -17,9 +17,6 @@ using System; using System.Collections; using System.Collections.Generic; -#if FEATURE_CORECLR -using System.Diagnostics.Contracts; -#endif using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -33,8 +30,6 @@ namespace System.Resources private CultureInfo m_neutralResourcesCulture; private bool m_useParents; -// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5 -#if FEATURE_CORECLR // 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. @@ -43,7 +38,6 @@ namespace System.Resources // as well to avoid differences across threads. [ThreadStatic] private static CultureInfo[] cachedOsFallbackArray; -#endif // FEATURE_CORECLR internal ResourceFallbackManager(CultureInfo startingCulture, CultureInfo neutralResourcesCulture, bool useParents) { @@ -91,8 +85,6 @@ namespace System.Resources yield break; } -// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5 -#if FEATURE_CORECLR // 2. user preferred cultures, omitting starting culture if tried already // Compat note: For console apps, this API will return cultures like Arabic // or Hebrew that are displayed right-to-left. These don't work with today's @@ -118,7 +110,6 @@ namespace System.Resources } } } -#endif // FEATURE_CORECLR // 3. invariant // Don't return invariant twice though. @@ -128,8 +119,6 @@ namespace System.Resources yield return CultureInfo.InvariantCulture; } -// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5 -#if FEATURE_CORECLR private static CultureInfo[] LoadPreferredCultures() { // The list of preferred cultures includes thread, process, user, and OS @@ -271,7 +260,5 @@ namespace System.Resources return CultureInfo.nativeGetResourceFallbackArray(); #endif } - -#endif // FEATURE_CORECLR } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs index 85086b7..6e3bd07 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceManager.cs @@ -31,9 +31,6 @@ namespace System.Resources { using System.Collections.Generic; using System.Runtime.Versioning; using System.Diagnostics.Contracts; -#if !FEATURE_CORECLR - using System.Diagnostics.Tracing; -#endif #if FEATURE_APPX // @@ -261,13 +258,6 @@ namespace System.Resources { protected ResourceManager() { -#if !FEATURE_CORECLR - // This constructor is not designed to be used under AppX and is not in the Win8 profile. - // However designers may use them even if they are running under AppX since they are - // not subject to the restrictions of the Win8 profile. - Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode()); -#endif - Init(); _lastUsedResourceCache = new CultureNameResourceSetPair(); @@ -292,13 +282,6 @@ namespace System.Resources { throw new ArgumentNullException(nameof(resourceDir)); Contract.EndContractBlock(); -#if !FEATURE_CORECLR - // This constructor is not designed to be used under AppX and is not in the Win8 profile. - // However designers may use them even if they are running under AppX since they are - // not subject to the restrictions of the Win8 profile. - Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode()); -#endif - BaseNameField = baseName; moduleDir = resourceDir; @@ -312,22 +295,8 @@ namespace System.Resources { ResourceManagerMediator mediator = new ResourceManagerMediator(this); resourceGroveler = new FileBasedResourceGroveler(mediator); - -#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr - if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) { - CultureInfo culture = CultureInfo.InvariantCulture; - String defaultResName = GetResourceFileName(culture); - - if (resourceGroveler.HasNeutralResources(culture, defaultResName)) { - FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName); - } - else { - FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, defaultResName); - } - } -#endif } - + [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable public ResourceManager(String baseName, Assembly assembly) { @@ -368,13 +337,6 @@ namespace System.Resources { throw new ArgumentNullException(nameof(assembly)); Contract.EndContractBlock(); -#if !FEATURE_CORECLR - // This constructor is not designed to be used under AppX and is not in the Win8 profile. - // However designers may use them even if they are running under AppX since they are - // not subject to the restrictions of the Win8 profile. - Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode()); -#endif - if (!(assembly is RuntimeAssembly)) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly")); @@ -489,30 +451,6 @@ namespace System.Resources { } _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc); - -#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr - if (_bUsingModernResourceManagement == false) - { - if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) { - CultureInfo culture = CultureInfo.InvariantCulture; - String defaultResName = GetResourceFileName(culture); - - if (resourceGroveler.HasNeutralResources(culture, defaultResName)) { - FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName); - } - else { - String outputResName = defaultResName; - if (_locationInfo != null && _locationInfo.Namespace != null) - outputResName = _locationInfo.Namespace + Type.Delimiter + defaultResName; - FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, outputResName); - } - } - -#pragma warning disable 618 - ResourceSets = new Hashtable(); // for backward compatibility -#pragma warning restore 618 - } -#endif } // Gets the base name for the ResourceManager. @@ -550,12 +488,6 @@ namespace System.Resources { // creating a new ResourceManager isn't quite the correct behavior. public virtual void ReleaseAllResources() { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerReleasingResources(BaseNameField, MainAssembly); - } -#endif Dictionary localResourceSets = _resourceSets; // If any calls to Close throw, at least leave ourselves in a @@ -566,27 +498,9 @@ namespace System.Resources { lock(localResourceSets) { IDictionaryEnumerator setEnum = localResourceSets.GetEnumerator(); -#if !FEATURE_CORECLR - IDictionaryEnumerator setEnum2 = null; -#pragma warning disable 618 - if (ResourceSets != null) { - setEnum2 = ResourceSets.GetEnumerator(); - } - ResourceSets = new Hashtable(); // for backwards compat -#pragma warning restore 618 -#endif - while (setEnum.MoveNext()) { ((ResourceSet)setEnum.Value).Close(); } - -#if !FEATURE_CORECLR - if (setEnum2 != null) { - while (setEnum2.MoveNext()) { - ((ResourceSet)setEnum2.Value).Close(); - } - } -#endif } } @@ -733,11 +647,6 @@ namespace System.Resources { CultureInfo foundCulture = null; lock (localResourceSets) { if (localResourceSets.TryGetValue(requestedCulture.Name, out rs)) { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) { - FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCache(BaseNameField, MainAssembly, requestedCulture.Name); - } -#endif return rs; } } @@ -746,20 +655,8 @@ namespace System.Resources { foreach (CultureInfo currentCultureInfo in mgr) { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerLookingForResourceSet(BaseNameField, MainAssembly, currentCultureInfo.Name); - } -#endif lock(localResourceSets) { if (localResourceSets.TryGetValue(currentCultureInfo.Name, out rs)) { -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCache(BaseNameField, MainAssembly, currentCultureInfo.Name); - } -#endif // we need to update the cache if we fellback if(requestedCulture != currentCultureInfo) foundCulture = currentCultureInfo; break; @@ -1017,8 +914,7 @@ namespace System.Resources { private bool ShouldUseSatelliteAssemblyResourceLookupUnderAppX(RuntimeAssembly resourcesAssembly) { bool fUseSatelliteAssemblyResourceLookupUnderAppX = resourcesAssembly.IsFrameworkAssembly(); - -#if FEATURE_CORECLR + if (!fUseSatelliteAssemblyResourceLookupUnderAppX) { // Check to see if the assembly is under PLATFORM_RESOURCE_ROOTS. If it is, then we should use satellite assembly lookup for it. @@ -1039,11 +935,10 @@ namespace System.Resources { } } } -#endif // FEATURE_CORECLR + return fUseSatelliteAssemblyResourceLookupUnderAppX; - } - + #endif // FEATURE_APPX // Only call SetAppXConfiguration from ResourceManager constructors, and nowhere else. // Throws MissingManifestResourceException and WinRT HResults @@ -1250,13 +1145,7 @@ namespace System.Resources { // This line behaves the same way as CultureInfo.CurrentUICulture would have in .NET 4 culture = Thread.CurrentThread.GetCurrentUICultureNoAppX(); } - -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerLookupStarted(BaseNameField, MainAssembly, culture.Name); - } -#endif + ResourceSet last = GetFirstResourceSet(culture); if (last != null) @@ -1294,13 +1183,6 @@ namespace System.Resources { last = rs; } } - -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerLookupFailed(BaseNameField, MainAssembly, culture.Name); - } -#endif } return null; @@ -1347,12 +1229,6 @@ namespace System.Resources { culture = Thread.CurrentThread.GetCurrentUICultureNoAppX(); } -#if !FEATURE_CORECLR - if (FrameworkEventSource.IsInitialized) - { - FrameworkEventSource.Log.ResourceManagerLookupStarted(BaseNameField, MainAssembly, culture.Name); - } -#endif ResourceSet last = GetFirstResourceSet(culture); if (last != null) { diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs b/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs index 2285abf..1b272fc 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs +++ b/src/coreclr/src/mscorlib/src/System/Resources/ResourceSet.cs @@ -31,15 +31,11 @@ namespace System.Resources { // stores them in a hash table. Custom IResourceReaders can be used. // [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public class ResourceSet : IDisposable, IEnumerable { [NonSerialized] protected IResourceReader Reader; -#if FEATURE_CORECLR internal Hashtable Table; -#else - protected Hashtable Table; -#endif private Hashtable _caseInsensitiveTable; // For case-insensitive lookups. @@ -182,11 +178,7 @@ namespace System.Resources { // GetDefaultReader and GetDefaultWriter. public virtual Type GetDefaultWriter() { -#if FEATURE_CORECLR return Type.GetType("System.Resources.ResourceWriter, System.Resources.Writer, Version=4.0.1.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.MicrosoftPublicKeyToken, throwOnError: true); -#else - return typeof(ResourceWriter); -#endif } [ComVisible(false)] diff --git a/src/coreclr/src/mscorlib/src/System/RtType.cs b/src/coreclr/src/mscorlib/src/System/RtType.cs index af9b00d..acb6127 100644 --- a/src/coreclr/src/mscorlib/src/System/RtType.cs +++ b/src/coreclr/src/mscorlib/src/System/RtType.cs @@ -1489,9 +1489,6 @@ namespace System private MemberInfoCache m_eventInfoCache; private static CerHashtable s_methodInstantiations; private static Object s_methodInstantiationsLock; -#if !FEATURE_CORECLR - private RuntimeConstructorInfo m_serializationCtor; -#endif private string m_defaultMemberName; private Object m_genericCache; // Generic cache for rare scenario specific data. It is used to cache Enum names and values. #endregion @@ -1641,26 +1638,6 @@ namespace System m_nestedClassesCache = null; } -#if !FEATURE_CORECLR - internal RuntimeConstructorInfo GetSerializationCtor() - { - if (m_serializationCtor == null) - { - if (s_SICtorParamTypes == null) - s_SICtorParamTypes = new Type[] { typeof(SerializationInfo), typeof(StreamingContext) }; - - m_serializationCtor = m_runtimeType.GetConstructor( - BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, - null, - CallingConventions.Any, - s_SICtorParamTypes, - null) as RuntimeConstructorInfo; - } - - return m_serializationCtor; - } -#endif //!FEATURE_CORECLR - internal string GetDefaultMemberName() { if (m_defaultMemberName == null) @@ -2617,13 +2594,6 @@ namespace System { return Cache.GetDefaultMemberName(); } - -#if !FEATURE_CORECLR - internal RuntimeConstructorInfo GetSerializationCtor() - { - return Cache.GetSerializationCtor(); - } -#endif #endregion #region Type Overrides @@ -3450,23 +3420,6 @@ namespace System return false; } -#if !FEATURE_CORECLR - // Reflexive, symmetric, transitive. - public override bool IsEquivalentTo(Type other) - { - RuntimeType otherRtType = other as RuntimeType; - if ((object)otherRtType == null) - return false; - - if (otherRtType == this) - return true; - - // It's not worth trying to perform further checks in managed - // as they would lead to FCalls anyway. - return RuntimeTypeHandle.IsEquivalentTo(this, otherRtType); - } -#endif // FEATURE_CORECLR - public override Type BaseType { get @@ -3650,16 +3603,6 @@ namespace System return IsSubclassOf(typeof(ValueType)); } -#if !FEATURE_CORECLR - public override bool IsEnum - { - get - { - return GetBaseType() == RuntimeType.EnumType; - } - } -#endif - protected override bool HasElementTypeImpl() { return RuntimeTypeHandle.HasElementType(this); @@ -4601,18 +4544,6 @@ namespace System return RuntimeHelpers.GetHashCode(this); } -#if !FEATURE_CORECLR - public static bool operator ==(RuntimeType left, RuntimeType right) - { - return object.ReferenceEquals(left, right); - } - - public static bool operator !=(RuntimeType left, RuntimeType right) - { - return !object.ReferenceEquals(left, right); - } -#endif // !FEATURE_CORECLR - public override String ToString() { return GetCachedName(TypeNameKind.ToString); @@ -5025,9 +4956,7 @@ namespace System bCanBeCached = false; } #endif -#if FEATURE_CORECLR bSecurityCheckOff = true; // CoreCLR does not use security at all. -#endif Object instance = RuntimeTypeHandle.CreateInstance(this, publicOnly, bSecurityCheckOff, ref bCanBeCached, ref runtime_ctor, ref bNeedSecurityCheck); @@ -5081,12 +5010,6 @@ namespace System if (ace.m_ctor != null) { -#if !FEATURE_CORECLR - // Perform security checks if needed - if (ace.m_bNeedSecurityCheck) - RuntimeMethodHandle.PerformSecurityCheck(instance, ace.m_hCtorMethodHandle, this, (uint)INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE); -#endif - // Call ctor (value types wont have any) try { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index f2f1ba2..926eb6c 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -25,14 +25,12 @@ namespace System.Runtime.CompilerServices { public static class RuntimeHelpers { -#if FEATURE_CORECLR // Exposed here as a more appropriate place than on FormatterServices itself, // which is a high level reflection heavy type. public static Object GetUninitializedObject(Type type) { return FormatterServices.GetUninitializedObject(type); } -#endif // FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void InitializeArray(Array array,RuntimeFieldHandle fldHandle); @@ -89,8 +87,6 @@ namespace System.Runtime.CompilerServices { [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] internal static extern void _CompileMethod(IRuntimeMethodInfo method); - - #if FEATURE_CORECLR public static void PrepareMethod(RuntimeMethodHandle method){} public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation){} public static void PrepareContractedDelegate(Delegate d){} @@ -103,59 +99,6 @@ namespace System.Runtime.CompilerServices { } } - #else - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static unsafe extern void _PrepareMethod(IRuntimeMethodInfo method, IntPtr* pInstantiation, int cInstantiation); - - // Simple (instantiation not required) method. - public static void PrepareMethod(RuntimeMethodHandle method) - { - unsafe - { - _PrepareMethod(method.GetMethodInfo(), null, 0); - } - } - - // Generic method or method with generic class with specific instantiation. - public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation) - { - unsafe - { - int length; - IntPtr[] instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out length); - fixed (IntPtr* pInstantiation = instantiationHandles) - { - _PrepareMethod(method.GetMethodInfo(), pInstantiation, length); - GC.KeepAlive(instantiation); - } - } - } - // This method triggers a given delegate to be prepared. This involves preparing the - // delegate's Invoke method and preparing the target of that Invoke. In the case of - // a multi-cast delegate, we rely on the fact that each individual component was prepared - // prior to the Combine. In other words, this service does not navigate through the - // entire multicasting list. - // If our own reliable event sinks perform the Combine (for example AppDomain.DomainUnload), - // then the result is fully prepared. But if a client calls Combine himself and then - // then adds that combination to e.g. AppDomain.DomainUnload, then the client is responsible - // for his own preparation. - [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void PrepareDelegate(Delegate d); - - // See comment above for PrepareDelegate - // - // PrepareContractedDelegate weakens this a bit by only assuring that we prepare - // delegates which also have a ReliabilityContract. This is useful for services that - // want to provide opt-in reliability, generally some random event sink providing - // always reliable semantics to random event handlers that are likely to have not - // been written with relability in mind is a lost cause anyway. - // - // NOTE: that for the NGen case you can sidestep the required ReliabilityContract - // by using the [PrePrepareMethod] attribute. - [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void PrepareContractedDelegate(Delegate d); - #endif [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern int GetHashCode(Object o); @@ -199,15 +142,9 @@ namespace System.Runtime.CompilerServices { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static extern bool TryEnsureSufficientExecutionStack(); - #if FEATURE_CORECLR public static void ProbeForSufficientStack() { } - #else - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - public static extern void ProbeForSufficientStack(); - #endif // This method is a marker placed immediately before a try clause to mark the corresponding catch and finally blocks as // constrained. There's no code here other than the probe because most of the work is done at JIT time when we spot a call to this routine. diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs index 10d7996..700e059 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs @@ -139,8 +139,6 @@ namespace System.Runtime.InteropServices // we'll do this to ensure we've cut off all attack vectors. Similarly, all // methods have a link demand to ensure untrusted code cannot directly edit // or alter a handle. -#if !FEATURE_CORECLR -#endif public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable { // ! Do not add or rearrange fields as the EE depends on this layout. @@ -166,10 +164,8 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable #endif } -#if FEATURE_CORECLR // Adding an empty default constructor for annotation purposes private CriticalHandle(){} -#endif [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] ~CriticalHandle() diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs index 9d5b239..2330365 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/IException.cs @@ -22,41 +22,9 @@ namespace System.Runtime.InteropServices { [GuidAttribute("b36b5c63-42ef-38bc-a07e-0b34c98f164a")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)] [CLSCompliant(false)] -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public interface _Exception { -#if !FEATURE_CORECLR - // This contains all of our V1 Exception class's members. - - // From Object - String ToString(); - bool Equals (Object obj); - int GetHashCode (); - Type GetType (); - - // From V1's Exception class - String Message { - get; - } - - Exception GetBaseException(); - - String StackTrace { - get; - } - - String HelpLink { - get; - set; - } - - String Source { - get; - set; - } - void GetObjectData(SerializationInfo info, StreamingContext context); -#endif - // // This method is intentionally included in CoreCLR to make Exception.get_InnerException "newslot virtual final". // Some phone apps include MEF from desktop Silverlight. MEF's ComposablePartException depends on implicit interface @@ -66,12 +34,5 @@ namespace System.Runtime.InteropServices { Exception InnerException { get; } - -#if !FEATURE_CORECLR - MethodBase TargetSite { - get; - } -#endif } - } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs index d89fd3f..d6f913e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs @@ -279,8 +279,6 @@ namespace System.Runtime.InteropServices [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern uint AlignedSizeOfType(Type type); -#if !FEATURE_CORECLR // Marshal is critical in CoreCLR, so SafeCritical members trigger Annotator violations -#endif // !FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int SizeOfHelper(Type t, bool throwIfNotMarshalable); @@ -405,16 +403,10 @@ namespace System.Runtime.InteropServices //==================================================================== // Read from memory //==================================================================== -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_RU1")] - [SuppressUnmanagedCodeSecurity] - public static extern byte ReadByte([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs); -#else public static byte ReadByte([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs) { throw new PlatformNotSupportedException(); - } -#endif // !FEATURE_CORECLR + } public static unsafe byte ReadByte(IntPtr ptr, int ofs) { @@ -434,17 +426,11 @@ namespace System.Runtime.InteropServices { return ReadByte(ptr,0); } - -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_RI2")] - [SuppressUnmanagedCodeSecurity] - public static extern short ReadInt16([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs); -#else + public static short ReadInt16([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs) { throw new PlatformNotSupportedException(); - } -#endif // !FEATURE_CORECLR + } public static unsafe short ReadInt16(IntPtr ptr, int ofs) { @@ -477,17 +463,11 @@ namespace System.Runtime.InteropServices { return ReadInt16(ptr, 0); } - -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_RI4"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SuppressUnmanagedCodeSecurity] - public static extern int ReadInt32([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs); -#else + public static int ReadInt32([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static unsafe int ReadInt32(IntPtr ptr, int ofs) @@ -555,16 +535,10 @@ namespace System.Runtime.InteropServices #endif } -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_RI8"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [SuppressUnmanagedCodeSecurity] - public static extern long ReadInt64([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs); -#else public static long ReadInt64([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR public static unsafe long ReadInt64(IntPtr ptr, int ofs) { @@ -623,16 +597,10 @@ namespace System.Runtime.InteropServices } } -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_WU1")] - [SuppressUnmanagedCodeSecurity] - public static extern void WriteByte([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, byte val); -#else public static void WriteByte([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, byte val) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR public static void WriteByte(IntPtr ptr, byte val) { @@ -663,18 +631,12 @@ namespace System.Runtime.InteropServices throw new AccessViolationException(); } } - -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_WI2")] - [SuppressUnmanagedCodeSecurity] - public static extern void WriteInt16([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, short val); -#else + public static void WriteInt16([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, short val) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR - + public static void WriteInt16(IntPtr ptr, short val) { WriteInt16(ptr, 0, val); @@ -721,17 +683,11 @@ namespace System.Runtime.InteropServices throw new AccessViolationException(); } } - -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_WI4")] - [SuppressUnmanagedCodeSecurity] - public static extern void WriteInt32([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, int val); -#else + public static void WriteInt32([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, int val) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR public static void WriteInt32(IntPtr ptr, int val) { @@ -795,17 +751,11 @@ namespace System.Runtime.InteropServices throw new AccessViolationException(); } } - -#if !FEATURE_CORECLR - [DllImport(Win32Native.SHIM, EntryPoint="ND_WI8")] - [SuppressUnmanagedCodeSecurity] - public static extern void WriteInt64([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, long val); -#else + public static void WriteInt64([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, long val) { throw new PlatformNotSupportedException(); } -#endif // !FEATURE_CORECLR public static void WriteInt64(IntPtr ptr, long val) { @@ -1499,93 +1449,8 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Type GetLoadedTypeForGUID(ref Guid guid); -#if !FEATURE_CORECLR // current implementation requires reflection only load - //==================================================================== - // map ITypeInfo* to Type - //==================================================================== - public static Type GetTypeForITypeInfo(IntPtr /* ITypeInfo* */ piTypeInfo) - { - ITypeInfo pTI = null; - ITypeLib pTLB = null; - Type TypeObj = null; - Assembly AsmBldr = null; - TypeLibConverter TlbConverter = null; - int Index = 0; - Guid clsid; - - // If the input ITypeInfo is NULL then return NULL. - if (piTypeInfo == IntPtr.Zero) - return null; - - // Wrap the ITypeInfo in a CLR object. - pTI = (ITypeInfo)GetObjectForIUnknown(piTypeInfo); - - // Check to see if a class exists with the specified GUID. - - clsid = GetTypeInfoGuid(pTI); - TypeObj = GetLoadedTypeForGUID(ref clsid); - - // If we managed to find the type based on the GUID then return it. - if (TypeObj != null) - return TypeObj; - - // There is no type with the specified GUID in the app domain so lets - // try and convert the containing typelib. - try - { - pTI.GetContainingTypeLib(out pTLB, out Index); - } - catch(COMException) - { - pTLB = null; - } - - // Check to see if we managed to get a containing typelib. - if (pTLB != null) - { - // Get the assembly name from the typelib. - AssemblyName AsmName = TypeLibConverter.GetAssemblyNameFromTypelib(pTLB, null, null, null, null, AssemblyNameFlags.None); - String AsmNameString = AsmName.FullName; - - // Check to see if the assembly that will contain the type already exists. - Assembly[] aAssemblies = Thread.GetDomain().GetAssemblies(); - int NumAssemblies = aAssemblies.Length; - for (int i = 0; i < NumAssemblies; i++) - { - if (String.Compare(aAssemblies[i].FullName, - AsmNameString,StringComparison.Ordinal) == 0) - AsmBldr = aAssemblies[i]; - } - - // If we haven't imported the assembly yet then import it. - if (AsmBldr == null) - { - TlbConverter = new TypeLibConverter(); - AsmBldr = TlbConverter.ConvertTypeLibToAssembly(pTLB, - GetTypeLibName(pTLB) + ".dll", 0, new ImporterCallback(), null, null, null, null); - } - - // Load the type object from the imported typelib. - // Call GetManagedTypeInfoNameInternal to align with TlbImp behavior - TypeObj = AsmBldr.GetType(GetManagedTypeInfoNameInternal(pTLB, pTI), true, false); - if (TypeObj != null && !TypeObj.IsVisible) - TypeObj = null; - } - else - { - // If the ITypeInfo does not have a containing typelib then simply - // return Object as the type. - TypeObj = typeof(Object); - } - - return TypeObj; - } -#endif // #if !FEATURE_CORECLR - // This method is identical to Type.GetTypeFromCLSID. Since it's interop specific, we expose it // on Marshal for more consistent API surface. -#if !FEATURE_CORECLR -#endif //!FEATURE_CORECLR public static Type GetTypeFromCLSID(Guid clsid) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, false); @@ -1629,11 +1494,7 @@ namespace System.Runtime.InteropServices //==================================================================== public static IntPtr /* IDispatch */ GetIDispatchForObject(Object o) { -#if FEATURE_CORECLR throw new PlatformNotSupportedException(); -#else - return GetIDispatchForObjectNative(o, false); -#endif // FEATURE_CORECLR } #if FEATURE_COMINTEROP @@ -1731,8 +1592,6 @@ namespace System.Runtime.InteropServices //==================================================================== // check if the object is classic COM component //==================================================================== -#if !FEATURE_CORECLR // with FEATURE_CORECLR, the whole type is SecurityCritical -#endif [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern bool IsComObject(Object o); @@ -1955,36 +1814,7 @@ namespace System.Runtime.InteropServices //==================================================================== public static Object GetComObjectData(Object obj, Object key) { -#if FEATURE_CORECLR throw new PlatformNotSupportedException(); -#else - // Validate that the arguments aren't null. - if (obj == null) - throw new ArgumentNullException(nameof(obj)); - if (key == null) - throw new ArgumentNullException(nameof(key)); - Contract.EndContractBlock(); - - __ComObject comObj = null; - - // Make sure the obj is an __ComObject. - try - { - comObj = (__ComObject)obj; - } - catch (InvalidCastException) - { - throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(obj)); - } - - if (obj.GetType().IsWindowsRuntimeObject) - { - throw new ArgumentException(Environment.GetResourceString("Argument_ObjIsWinRTObject"), nameof(obj)); - } - - // Retrieve the data from the __ComObject. - return comObj.GetData(key); -#endif // FEATURE_CORECLR } //==================================================================== @@ -1995,36 +1825,7 @@ namespace System.Runtime.InteropServices //==================================================================== public static bool SetComObjectData(Object obj, Object key, Object data) { -#if FEATURE_CORECLR throw new PlatformNotSupportedException(); -#else - // Validate that the arguments aren't null. The data can validly be null. - if (obj == null) - throw new ArgumentNullException(nameof(obj)); - if (key == null) - throw new ArgumentNullException(nameof(key)); - Contract.EndContractBlock(); - - __ComObject comObj = null; - - // Make sure the obj is an __ComObject. - try - { - comObj = (__ComObject)obj; - } - catch (InvalidCastException) - { - throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(obj)); - } - - if (obj.GetType().IsWindowsRuntimeObject) - { - throw new ArgumentException(Environment.GetResourceString("Argument_ObjIsWinRTObject"), nameof(obj)); - } - - // Retrieve the data from the __ComObject. - return comObj.SetData(key, data); -#endif // FEATURE_CORECLR } #if FEATURE_COMINTEROP @@ -2205,19 +2006,8 @@ namespace System.Runtime.InteropServices //==================================================================== public static Guid GenerateGuidForType(Type type) { -#if FEATURE_CORECLR return type.GUID; } -#else - Guid result = new Guid (); - FCallGenerateGuidForType (ref result, type); - return result; - } - - // The full assembly name is used to compute the GUID, so this should be SxS-safe - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallGenerateGuidForType(ref Guid result, Type type); -#endif // FEATURE_CORECLR //==================================================================== // This method generates a PROGID for the specified type. If the type @@ -2235,11 +2025,6 @@ namespace System.Runtime.InteropServices throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type)); Contract.EndContractBlock(); -#if !FEATURE_CORECLR - if (!RegistrationServices.TypeRequiresRegistrationHelper(type)) - throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustBeComCreatable"), nameof(type)); -#endif // FEATURE_CORECLR - IList cas = CustomAttributeData.GetCustomAttributes(type); for (int i = 0; i < cas.Count; i ++) { @@ -2586,41 +2371,5 @@ namespace System.Runtime.InteropServices FreeHGlobal(s); } } - -#if FEATURE_COMINTEROP && !FEATURE_CORECLR // current implementation requires reflection only load - //======================================================================== - // Typelib importer callback implementation. - //======================================================================== - internal class ImporterCallback : ITypeLibImporterNotifySink - { - public void ReportEvent(ImporterEventKind EventKind, int EventCode, String EventMsg) - { - } - - public Assembly ResolveRef(Object TypeLib) - { - try - { - // Create the TypeLibConverter. - ITypeLibConverter TLBConv = new TypeLibConverter(); - - // Convert the typelib. - return TLBConv.ConvertTypeLibToAssembly(TypeLib, - Marshal.GetTypeLibName((ITypeLib)TypeLib) + ".dll", - 0, - new ImporterCallback(), - null, - null, - null, - null); - } - catch(Exception) -// catch - { - return null; - } - } - } -#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs index 50fead7..a5c058d 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs @@ -23,24 +23,10 @@ using Microsoft.Win32; using System.Runtime.Versioning; using StackCrawlMark = System.Threading.StackCrawlMark; -namespace System.Runtime.InteropServices { -[System.Runtime.InteropServices.ComVisible(true)] -#if FEATURE_CORECLR - static -#endif - public class RuntimeEnvironment { - -#if !FEATURE_CORECLR - // This should have been a static class, but wasn't as of v3.5. Clearly, this is - // broken. We'll keep this in V4 for binary compat, but marked obsolete as error - // so migrated source code gets fixed. On Silverlight, this type exists but is - // not public. - [Obsolete("Do not create instances of the RuntimeEnvironment class. Call the static methods directly on this type instead", true)] - public RuntimeEnvironment() - { - // Should not have been instantiable - here for binary compatibility in V4. - } -#endif +namespace System.Runtime.InteropServices +{ + [System.Runtime.InteropServices.ComVisible(true)] + static public class RuntimeEnvironment { [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetModuleFileName(); @@ -51,36 +37,17 @@ namespace System.Runtime.InteropServices { [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetHostBindingFile(); -#if !FEATURE_CORECLR - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SuppressUnmanagedCodeSecurity] - internal static extern void _GetSystemVersion(StringHandleOnStack retVer); -#endif //!FEATURE_CORECLR - public static bool FromGlobalAccessCache(Assembly a) { return a.GlobalAssemblyCache; } - -#if !FEATURE_CORECLR -#endif + [MethodImpl (MethodImplOptions.NoInlining)] public static String GetSystemVersion() { -#if FEATURE_CORECLR - return Assembly.GetExecutingAssembly().ImageRuntimeVersion; - -#else // FEATURE_CORECLR - - String ver = null; - _GetSystemVersion(JitHelpers.GetStringHandleOnStack(ref ver)); - return ver; - -#endif // FEATURE_CORECLR - } - + public static String GetRuntimeDirectory() { String dir = GetRuntimeDirectoryImpl(); @@ -148,7 +115,6 @@ namespace System.Runtime.InteropServices { } } } - #endif // FEATURE_COMINTEROP } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs index 554c6ba..ed9910e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs @@ -134,8 +134,6 @@ using System.Runtime.Versioning; // we'll do this to ensure we've cut off all attack vectors. Similarly, all // methods have a link demand to ensure untrusted code cannot directly edit // or alter a handle. -#if !FEATURE_CORECLR -#endif public abstract class SafeHandle : CriticalFinalizerObject, IDisposable { // ! Do not add or rearrange fields as the EE depends on this layout. @@ -180,14 +178,12 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable _fullyInitialized = true; } -#if FEATURE_CORECLR // Migrating InheritanceDemands requires this default ctor, so we can mark it critical protected SafeHandle() { BCLDebug.Assert(false, "SafeHandle's protected default ctor should never be used!"); throw new NotImplementedException(); } -#endif ~SafeHandle() { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs deleted file mode 100644 index 629c414..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs +++ /dev/null @@ -1,595 +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. - -/*============================================================================= -** -** -** -** Purpose: Component that implements the ITypeLibConverter interface and -** does the actual work of converting a typelib to metadata and -** vice versa. -** -** -=============================================================================*/ -#if !FEATURE_CORECLR // current implementation requires reflection only load -namespace System.Runtime.InteropServices { - - using System; - using System.Diagnostics.Contracts; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Runtime.InteropServices.TCEAdapterGen; - using System.IO; - using System.Reflection; - using System.Reflection.Emit; - using System.Configuration.Assemblies; - using Microsoft.Win32; - using System.Runtime.CompilerServices; - using System.Globalization; - using System.Security; - using System.Security.Permissions; - using System.Runtime.InteropServices.ComTypes; - using System.Runtime.Versioning; - using WORD = System.UInt16; - using DWORD = System.UInt32; - using _TYPELIBATTR = System.Runtime.InteropServices.ComTypes.TYPELIBATTR; - - [Guid("F1C3BF79-C3E4-11d3-88E7-00902754C43A")] - [ClassInterface(ClassInterfaceType.None)] -[System.Runtime.InteropServices.ComVisible(true)] - public sealed class TypeLibConverter : ITypeLibConverter - { - private const String s_strTypeLibAssemblyTitlePrefix = "TypeLib "; - private const String s_strTypeLibAssemblyDescPrefix = "Assembly generated from typelib "; - private const int MAX_NAMESPACE_LENGTH = 1024; - - - // - // ITypeLibConverter interface. - // - - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] - public AssemblyBuilder ConvertTypeLibToAssembly([MarshalAs(UnmanagedType.Interface)] Object typeLib, - String asmFileName, - int flags, - ITypeLibImporterNotifySink notifySink, - byte[] publicKey, - StrongNameKeyPair keyPair, - bool unsafeInterfaces) - { - return ConvertTypeLibToAssembly(typeLib, - asmFileName, - (unsafeInterfaces - ? TypeLibImporterFlags.UnsafeInterfaces - : 0), - notifySink, - publicKey, - keyPair, - null, - null); - } - - - - - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] - public AssemblyBuilder ConvertTypeLibToAssembly([MarshalAs(UnmanagedType.Interface)] Object typeLib, - String asmFileName, - TypeLibImporterFlags flags, - ITypeLibImporterNotifySink notifySink, - byte[] publicKey, - StrongNameKeyPair keyPair, - String asmNamespace, - Version asmVersion) - { - // Validate the arguments. - if (typeLib == null) - throw new ArgumentNullException(nameof(typeLib)); - if (asmFileName == null) - throw new ArgumentNullException(nameof(asmFileName)); - if (notifySink == null) - throw new ArgumentNullException(nameof(notifySink)); - if (String.Empty.Equals(asmFileName)) - throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileName"), nameof(asmFileName)); - if (asmFileName.Length > Path.MaxPath) - throw new ArgumentException(Environment.GetResourceString("IO.PathTooLong"), asmFileName); - if ((flags & TypeLibImporterFlags.PrimaryInteropAssembly) != 0 && publicKey == null && keyPair == null) - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_PIAMustBeStrongNamed")); - Contract.EndContractBlock(); - - ArrayList eventItfInfoList = null; - - // Determine the AssemblyNameFlags - AssemblyNameFlags asmNameFlags = AssemblyNameFlags.None; - - // Retrieve the assembly name from the typelib. - AssemblyName asmName = GetAssemblyNameFromTypelib(typeLib, asmFileName, publicKey, keyPair, asmVersion, asmNameFlags); - - // Create the dynamic assembly that will contain the converted typelib types. - AssemblyBuilder asmBldr = CreateAssemblyForTypeLib(typeLib, asmFileName, asmName, - (flags & TypeLibImporterFlags.PrimaryInteropAssembly) != 0, - (flags & TypeLibImporterFlags.ReflectionOnlyLoading) != 0, - (flags & TypeLibImporterFlags.NoDefineVersionResource) != 0); - - // Define a dynamic module that will contain the contain the imported types. - String strNonQualifiedAsmFileName = Path.GetFileName(asmFileName); - ModuleBuilder modBldr = asmBldr.DefineDynamicModule(strNonQualifiedAsmFileName, strNonQualifiedAsmFileName); - - // If the namespace hasn't been specified, then use the assembly name. - if (asmNamespace == null) - asmNamespace = asmName.Name; - - // Create a type resolve handler that will also intercept resolve ref messages - // on the sink interface to build up a list of referenced assemblies. - TypeResolveHandler typeResolveHandler = new TypeResolveHandler(modBldr, notifySink); - - // Add a listener for the type resolve events. - AppDomain currentDomain = Thread.GetDomain(); - ResolveEventHandler resolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveEvent); - ResolveEventHandler asmResolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveAsmEvent); - ResolveEventHandler ROAsmResolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveROAsmEvent); - currentDomain.TypeResolve += resolveHandler; - currentDomain.AssemblyResolve += asmResolveHandler; - currentDomain.ReflectionOnlyAssemblyResolve += ROAsmResolveHandler; - - // Convert the types contained in the typelib into metadata and add them to the assembly. - nConvertTypeLibToMetadata(typeLib, asmBldr.InternalAssembly, modBldr.InternalModule, asmNamespace, flags, typeResolveHandler, out eventItfInfoList); - - // Update the COM types in the assembly. - UpdateComTypesInAssembly(asmBldr, modBldr); - - // If there are any event sources then generate the TCE adapters. - if (eventItfInfoList.Count > 0) - new TCEAdapterGenerator().Process(modBldr, eventItfInfoList); - - // Remove the listener for the type resolve events. - currentDomain.TypeResolve -= resolveHandler; - currentDomain.AssemblyResolve -= asmResolveHandler; - currentDomain.ReflectionOnlyAssemblyResolve -= ROAsmResolveHandler; - - // We have finished converting the typelib and now have a fully formed assembly. - return asmBldr; - } - - [System.Security.SecuritySafeCritical] // auto-generated - [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] - [return : MarshalAs(UnmanagedType.Interface)] - public Object ConvertAssemblyToTypeLib(Assembly assembly, String strTypeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink) - { - RuntimeAssembly rtAssembly; - AssemblyBuilder ab = assembly as AssemblyBuilder; - if (ab != null) - rtAssembly = ab.InternalAssembly; - else - rtAssembly = assembly as RuntimeAssembly; - - return nConvertAssemblyToTypeLib(rtAssembly, strTypeLibName, flags, notifySink); - } - - public bool GetPrimaryInteropAssembly(Guid g, Int32 major, Int32 minor, Int32 lcid, out String asmName, out String asmCodeBase) - { - String strTlbId = "{" + g.ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; - String strVersion = major.ToString("x", CultureInfo.InvariantCulture) + "." + minor.ToString("x", CultureInfo.InvariantCulture); - - // Set the two out values to null before we start. - asmName = null; - asmCodeBase = null; - - // Try to open the HKEY_CLASS_ROOT\TypeLib key. - using (RegistryKey TypeLibKey = Registry.ClassesRoot.OpenSubKey("TypeLib", false)) - { - if (TypeLibKey != null) - { - // Try to open the HKEY_CLASS_ROOT\TypeLib\ key. - using (RegistryKey TypeLibSubKey = TypeLibKey.OpenSubKey(strTlbId)) - { - if (TypeLibSubKey != null) - { - // Try to open the HKEY_CLASS_ROOT\TypeLib\\ key. - using (RegistryKey VersionKey = TypeLibSubKey.OpenSubKey(strVersion, false)) - { - if (VersionKey != null) - { - // Attempt to retrieve the assembly name and codebase under the version key. - asmName = (String)VersionKey.GetValue("PrimaryInteropAssemblyName"); - asmCodeBase = (String)VersionKey.GetValue("PrimaryInteropAssemblyCodeBase"); - } - } - } - } - } - } - - // If the assembly name isn't null, then we found an PIA. - return asmName != null; - } - - - // - // Non native helper methods. - // - - [System.Security.SecurityCritical] // auto-generated - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - private static AssemblyBuilder CreateAssemblyForTypeLib(Object typeLib, String asmFileName, AssemblyName asmName, bool bPrimaryInteropAssembly, bool bReflectionOnly, bool bNoDefineVersionResource) - { - // Retrieve the current app domain. - AppDomain currentDomain = Thread.GetDomain(); - - // Retrieve the directory from the assembly file name. - String dir = null; - if (asmFileName != null) - { - dir = Path.GetDirectoryName(asmFileName); - if (String.IsNullOrEmpty(dir)) - dir = null; - } - - AssemblyBuilderAccess aba; - if (bReflectionOnly) - { - aba = AssemblyBuilderAccess.ReflectionOnly; - } - else - { - aba = AssemblyBuilderAccess.RunAndSave; - } - - // Create the dynamic assembly itself. - AssemblyBuilder asmBldr; - - List assemblyAttributes = new List(); -#if !FEATURE_CORECLR - // mscorlib.dll must specify the security rules that assemblies it emits are to use, since by - // default all assemblies will follow security rule set level 2, and we want to make that an - // explicit decision. - ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) }); - CustomAttributeBuilder securityRulesAttribute = - new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level2 }); - assemblyAttributes.Add(securityRulesAttribute); -#endif // !FEATURE_CORECLR - - asmBldr = currentDomain.DefineDynamicAssembly(asmName, aba, dir, false, assemblyAttributes); - - // Set the Guid custom attribute on the assembly. - SetGuidAttributeOnAssembly(asmBldr, typeLib); - - // Set the imported from COM attribute on the assembly and return it. - SetImportedFromTypeLibAttrOnAssembly(asmBldr, typeLib); - - // Set the version information on the typelib. - if (bNoDefineVersionResource) - { - SetTypeLibVersionAttribute(asmBldr, typeLib); - } - else - { - SetVersionInformation(asmBldr, typeLib, asmName); - } - - // If we are generating a PIA, then set the PIA custom attribute. - if (bPrimaryInteropAssembly) - SetPIAAttributeOnAssembly(asmBldr, typeLib); - - return asmBldr; - } - - [System.Security.SecurityCritical] // auto-generated - internal static AssemblyName GetAssemblyNameFromTypelib(Object typeLib, String asmFileName, byte[] publicKey, StrongNameKeyPair keyPair, Version asmVersion, AssemblyNameFlags asmNameFlags) - { - // Extract the name of the typelib. - String strTypeLibName = null; - String strDocString = null; - int dwHelpContext = 0; - String strHelpFile = null; - ITypeLib pTLB = (ITypeLib)typeLib; - pTLB.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile); - - // Retrieve the name to use for the assembly. - if (asmFileName == null) - { - asmFileName = strTypeLibName; - } - else - { - Contract.Assert((asmFileName != null) && (asmFileName.Length > 0), "The assembly file name cannot be an empty string!"); - - String strFileNameNoPath = Path.GetFileName(asmFileName); - String strExtension = Path.GetExtension(asmFileName); - - // Validate that the extension is valid. - bool bExtensionValid = ".dll".Equals(strExtension, StringComparison.OrdinalIgnoreCase); - - // If the extension is not valid then tell the user and quit. - if (!bExtensionValid) - throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileExtension")); - - // The assembly cannot contain the path nor the extension. - asmFileName = strFileNameNoPath.Substring(0, strFileNameNoPath.Length - ".dll".Length); - } - - // If the version information was not specified, then retrieve it from the typelib. - if (asmVersion == null) - { - int major; - int minor; - Marshal.GetTypeLibVersion(pTLB, out major, out minor); - asmVersion = new Version(major, minor, 0, 0); - } - - // Create the assembly name for the imported typelib's assembly. - AssemblyName AsmName = new AssemblyName(); - AsmName.Init( - asmFileName, - publicKey, - null, - asmVersion, - null, - AssemblyHashAlgorithm.None, - AssemblyVersionCompatibility.SameMachine, - null, - asmNameFlags, - keyPair); - - return AsmName; - } - - private static void UpdateComTypesInAssembly(AssemblyBuilder asmBldr, ModuleBuilder modBldr) - { - // Retrieve the AssemblyBuilderData associated with the assembly builder. - AssemblyBuilderData AsmBldrData = asmBldr.m_assemblyData; - - // Go through the types in the module and add them as public COM types. - Type[] aTypes = modBldr.GetTypes(); - int NumTypes = aTypes.Length; - for (int cTypes = 0; cTypes < NumTypes; cTypes++) - AsmBldrData.AddPublicComType(aTypes[cTypes]); - } - - - [System.Security.SecurityCritical] // auto-generated - private static void SetGuidAttributeOnAssembly(AssemblyBuilder asmBldr, Object typeLib) - { - // Retrieve the GuidAttribute constructor. - Type []aConsParams = new Type[1] {typeof(String)}; - ConstructorInfo GuidAttrCons = typeof(GuidAttribute).GetConstructor(aConsParams); - - // Create an instance of the custom attribute builder. - Object[] aArgs = new Object[1] {Marshal.GetTypeLibGuid((ITypeLib)typeLib).ToString()}; - CustomAttributeBuilder GuidCABuilder = new CustomAttributeBuilder(GuidAttrCons, aArgs); - - // Set the GuidAttribute on the assembly builder. - asmBldr.SetCustomAttribute(GuidCABuilder); - } - - [System.Security.SecurityCritical] // auto-generated - private static void SetImportedFromTypeLibAttrOnAssembly(AssemblyBuilder asmBldr, Object typeLib) - { - // Retrieve the ImportedFromTypeLibAttribute constructor. - Type []aConsParams = new Type[1] {typeof(String)}; - ConstructorInfo ImpFromComAttrCons = typeof(ImportedFromTypeLibAttribute).GetConstructor(aConsParams); - - // Retrieve the name of the typelib. - String strTypeLibName = Marshal.GetTypeLibName((ITypeLib)typeLib); - - // Create an instance of the custom attribute builder. - Object[] aArgs = new Object[1] {strTypeLibName}; - CustomAttributeBuilder ImpFromComCABuilder = new CustomAttributeBuilder(ImpFromComAttrCons, aArgs); - - // Set the ImportedFromTypeLibAttribute on the assembly builder. - asmBldr.SetCustomAttribute(ImpFromComCABuilder); - } - - [System.Security.SecurityCritical] // auto-generated - private static void SetTypeLibVersionAttribute(AssemblyBuilder asmBldr, Object typeLib) - { - Type []aConsParams = new Type[2] {typeof(int), typeof(int)}; - ConstructorInfo TypeLibVerCons = typeof(TypeLibVersionAttribute).GetConstructor(aConsParams); - - // Get the typelib version - int major; - int minor; - Marshal.GetTypeLibVersion((ITypeLib)typeLib, out major, out minor); - - // Create an instance of the custom attribute builder. - Object[] aArgs = new Object[2] {major, minor}; - CustomAttributeBuilder TypeLibVerBuilder = new CustomAttributeBuilder(TypeLibVerCons, aArgs); - - // Set the attribute on the assembly builder. - asmBldr.SetCustomAttribute(TypeLibVerBuilder); - } - - [System.Security.SecurityCritical] // auto-generated - private static void SetVersionInformation(AssemblyBuilder asmBldr, Object typeLib, AssemblyName asmName) - { - // Extract the name of the typelib. - String strTypeLibName = null; - String strDocString = null; - int dwHelpContext = 0; - String strHelpFile = null; - ITypeLib pTLB = (ITypeLib)typeLib; - pTLB.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile); - - // Generate the product name string from the named of the typelib. - String strProductName = String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("TypeLibConverter_ImportedTypeLibProductName"), strTypeLibName); - - // Set the OS version information. - asmBldr.DefineVersionInfoResource(strProductName, asmName.Version.ToString(), null, null, null); - - // Set the TypeLibVersion attribute - SetTypeLibVersionAttribute(asmBldr, typeLib); - } - - [System.Security.SecurityCritical] // auto-generated - private static void SetPIAAttributeOnAssembly(AssemblyBuilder asmBldr, Object typeLib) - { - IntPtr pAttr = IntPtr.Zero; - _TYPELIBATTR Attr; - ITypeLib pTLB = (ITypeLib)typeLib; - int Major = 0; - int Minor = 0; - - // Retrieve the PrimaryInteropAssemblyAttribute constructor. - Type []aConsParams = new Type[2] {typeof(int), typeof(int)}; - ConstructorInfo PIAAttrCons = typeof(PrimaryInteropAssemblyAttribute).GetConstructor(aConsParams); - - // Retrieve the major and minor version from the typelib. - try - { - pTLB.GetLibAttr(out pAttr); - Attr = (_TYPELIBATTR)Marshal.PtrToStructure(pAttr, typeof(_TYPELIBATTR)); - Major = Attr.wMajorVerNum; - Minor = Attr.wMinorVerNum; - } - finally - { - // Release the typelib attributes. - if (pAttr != IntPtr.Zero) - pTLB.ReleaseTLibAttr(pAttr); - } - - // Create an instance of the custom attribute builder. - Object[] aArgs = new Object[2] {Major, Minor}; - CustomAttributeBuilder PIACABuilder = new CustomAttributeBuilder(PIAAttrCons, aArgs); - - // Set the PrimaryInteropAssemblyAttribute on the assembly builder. - asmBldr.SetCustomAttribute(PIACABuilder); - } - - - // - // Native helper methods. - // - - [System.Security.SecurityCritical] // auto-generated - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void nConvertTypeLibToMetadata(Object typeLib, RuntimeAssembly asmBldr, RuntimeModule modBldr, String nameSpace, TypeLibImporterFlags flags, ITypeLibImporterNotifySink notifySink, out ArrayList eventItfInfoList); - - // Must use assembly versioning or GuidAttribute to avoid collisions in typelib export or registration. - [System.Security.SecurityCritical] // auto-generated - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object nConvertAssemblyToTypeLib(RuntimeAssembly assembly, String strTypeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink); - - [System.Security.SecurityCritical] // auto-generated - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity] - internal extern static void LoadInMemoryTypeByName(RuntimeModule module, String className); - - // - // Helper class called when a resolve type event is fired. - // - - private class TypeResolveHandler : ITypeLibImporterNotifySink - { - public TypeResolveHandler(ModuleBuilder mod, ITypeLibImporterNotifySink userSink) - { - m_Module = mod; - m_UserSink = userSink; - } - - public void ReportEvent(ImporterEventKind eventKind, int eventCode, String eventMsg) - { - m_UserSink.ReportEvent(eventKind, eventCode, eventMsg); - } - - public Assembly ResolveRef(Object typeLib) - { - Contract.Ensures(Contract.Result() != null && Contract.Result() is RuntimeAssembly); - Contract.EndContractBlock(); - - // Call the user sink to resolve the reference. - Assembly asm = m_UserSink.ResolveRef(typeLib); - - if (asm == null) - throw new ArgumentNullException(); - - // Return the resolved assembly. We extract the internal assembly because we are called - // by the VM which accesses fields of the object directly and does not go via those - // delegating properties (the fields are empty if asm is an (external) AssemblyBuilder). - - RuntimeAssembly rtAssembly = asm as RuntimeAssembly; - if (rtAssembly == null) - { - AssemblyBuilder ab = asm as AssemblyBuilder; - if (ab != null) - rtAssembly = ab.InternalAssembly; - } - - if (rtAssembly == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly")); - - // Add the assembly to the list of assemblies. - m_AsmList.Add(rtAssembly); - - return rtAssembly; - } - - [System.Security.SecurityCritical] // auto-generated - public Assembly ResolveEvent(Object sender, ResolveEventArgs args) - { - // We need to load the type in the resolve event so that we will deal with - // cases where we are trying to load the CoClass before the interface has - // been loaded. - try - { - LoadInMemoryTypeByName(m_Module.GetNativeHandle(), args.Name); - return m_Module.Assembly; - } - catch (TypeLoadException e) - { - if (e.ResourceId != System.__HResults.COR_E_TYPELOAD) // type not found - throw; - } - - foreach (RuntimeAssembly asm in m_AsmList) - { - try - { - asm.GetType(args.Name, true, false); - return asm; - } - catch (TypeLoadException e) - { - if (e._HResult != System.__HResults.COR_E_TYPELOAD) // type not found - throw; - } - } - - return null; - } - - public Assembly ResolveAsmEvent(Object sender, ResolveEventArgs args) - { - foreach (RuntimeAssembly asm in m_AsmList) - { - if (String.Compare(asm.FullName, args.Name, StringComparison.OrdinalIgnoreCase) == 0) - return asm; - } - - return null; - } - - public Assembly ResolveROAsmEvent(Object sender, ResolveEventArgs args) - { - foreach (RuntimeAssembly asm in m_AsmList) - { - if (String.Compare(asm.FullName, args.Name, StringComparison.OrdinalIgnoreCase) == 0) - return asm; - } - - // We failed to find the referenced assembly in our pre-loaded assemblies, so try to load it based on policy. - string asmName = AppDomain.CurrentDomain.ApplyPolicy(args.Name); - return Assembly.ReflectionOnlyLoad(asmName); - } - - private ModuleBuilder m_Module; - private ITypeLibImporterNotifySink m_UserSink; - private List m_AsmList = new List(); - } - } -} -#endif // !FEATURE_CORECLR // current implementation requires reflection only load - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs index 48bcc4f..9de5e3f 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs @@ -8,9 +8,7 @@ using System; namespace System.Runtime.InteropServices.WindowsRuntime { -#if FEATURE_CORECLR [System.Runtime.CompilerServices.FriendAccessAllowed] -#endif [ComImport] [Guid("82BA7092-4C88-427D-A7BC-16DD93FEB67E")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs index 34714f1..eb5a186 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs @@ -22,8 +22,6 @@ using System.Runtime.InteropServices; namespace System.Runtime.ConstrainedExecution { -#if !FEATURE_CORECLR -#endif [System.Runtime.InteropServices.ComVisible(true)] public abstract class CriticalFinalizerObject { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs index 875001c..92a6ce6 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -165,12 +165,6 @@ namespace System.Runtime.Serialization internal static void DemandForUnsafeAssemblyNameAssignments(string originalAssemblyName, string newAssemblyName) { -#if !FEATURE_CORECLR - if (!IsAssemblyNameAssignmentSafe(originalAssemblyName, newAssemblyName)) - { - CodeAccessPermission.Demand(PermissionType.SecuritySerialization); - } -#endif } internal static bool IsAssemblyNameAssignmentSafe(string originalAssemblyName, string newAssemblyName) @@ -408,15 +402,10 @@ namespace System.Runtime.Serialization **Exceptions: None. All error checking is done with asserts. Although public in coreclr, ** it's not exposed in a contract and is only meant to be used by corefx. ==============================================================================*/ -#if FEATURE_CORECLR // This should not be used by clients: exposing out this functionality would allow children // to overwrite their parent's values. It is public in order to give corefx access to it for // its ObjectManager implementation, but it should not be exposed out of a contract. - public -#else - internal -#endif - void UpdateValue(String name, Object value, Type type) + public void UpdateValue(String name, Object value, Type type) { Contract.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null"); Contract.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null"); diff --git a/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs b/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs index 198cbde..127da1e 100644 --- a/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs +++ b/src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs @@ -717,14 +717,6 @@ namespace System info.AddValue("TypeObj", m_type, typeof(RuntimeType)); } - -#if !FEATURE_CORECLR - [MethodImpl(MethodImplOptions.InternalCall)] - internal static extern bool IsEquivalentTo(RuntimeType rtType1, RuntimeType rtType2); - - [MethodImpl(MethodImplOptions.InternalCall)] - internal static extern bool IsEquivalentType(RuntimeType type); -#endif // FEATURE_CORECLR } // This type is used to remove the expense of having a managed reference object that is dynamically @@ -1038,17 +1030,6 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern internal uint GetSpecialSecurityFlags(IRuntimeMethodInfo method); -#if !FEATURE_CORECLR - [MethodImplAttribute(MethodImplOptions.InternalCall)] - static extern internal void PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, uint invocationFlags); - - static internal void PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags) - { - RuntimeMethodHandle.PerformSecurityCheck(obj, method.Value, parent, invocationFlags); - GC.KeepAlive(method); - return; - } -#endif //!FEATURE_CORECLR #endregion [DebuggerStepThroughAttribute] diff --git a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs index c3e22b0..90b1201 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessPermission.cs @@ -18,8 +18,6 @@ namespace System.Security using IUnrestrictedPermission = System.Security.Permissions.IUnrestrictedPermission; [Serializable] -#if !FEATURE_CORECLR -#endif [System.Runtime.InteropServices.ComVisible(true)] abstract public class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk diff --git a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs index e31fe6a..0bdb9b7 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs @@ -58,32 +58,16 @@ namespace System.Security { [System.Diagnostics.Conditional( "_DEBUG" )] private static void DEBUG_OUT( String str ) { -#if _DEBUG +#if _DEBUG if (debug) - { -#if !FEATURE_CORECLR - if (to_file) - { - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - sb.Append( str ); - sb.Append ((char)13) ; - sb.Append ((char)10) ; - PolicyManager.DebugOut( file, sb.ToString() ); - } - else -#endif - Console.WriteLine( str ); - } -#endif + Console.WriteLine( str ); +#endif } - -#if _DEBUG + +#if _DEBUG private static bool debug = false; -#if !FEATURE_CORECLR - private static readonly bool to_file = false; -#endif private const String file = "d:\\foo\\debug.txt"; -#endif +#endif // static default constructor. This will be called before any of the static members are accessed. static CodeAccessSecurityEngine() diff --git a/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs b/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs index ba59303..5313798 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/HostSecurityManager.cs @@ -35,8 +35,6 @@ namespace System.Security } [Serializable] -#if !FEATURE_CORECLR -#endif [System.Runtime.InteropServices.ComVisible(true)] public class HostSecurityManager { public HostSecurityManager () {} diff --git a/src/coreclr/src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs b/src/coreclr/src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs index d346a11..c4facbb 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs @@ -41,11 +41,9 @@ namespace System.Security.Permissions [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false )] [System.Runtime.InteropServices.ComVisible(true)] [Serializable] -#if FEATURE_CORECLR // This needs to be in the asmmeta to enable SecAnnotate to successfully resolve and run the security rules. It gets marked // as internal by BCLRewriter so we are simply marking it as FriendAccessAllowed so it stays in the asmmeta. [System.Runtime.CompilerServices.FriendAccessAllowedAttribute] -#endif // FEATURE_CORECLR #pragma warning disable 618 sealed public class HostProtectionAttribute : CodeAccessSecurityAttribute #pragma warning restore 618 diff --git a/src/coreclr/src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs b/src/coreclr/src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs index fa77ac5..9eec46f 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs @@ -2,15 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// - namespace System.Security.Principal { -#if !FEATURE_CORECLR - [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] -#endif - public enum TokenImpersonationLevel { + public enum TokenImpersonationLevel + { None = 0, Anonymous = 1, Identification = 2, diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityElement.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityElement.cs index 5fe7b65..39cd4fb 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityElement.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityElement.cs @@ -623,23 +623,11 @@ namespace System.Security return sb.ToString(); } -#if !FEATURE_CORECLR - private static void ToStringHelperStreamWriter(Object obj, String str) - { - ((StreamWriter)obj).Write(str); - } - - internal void ToWriter( StreamWriter writer ) - { - ToString( "", writer, new ToStringHelperFunc( ToStringHelperStreamWriter ) ); - } -#endif - private void ToString( String indent, Object obj, ToStringHelperFunc func ) { // First add the indent - // func( obj, indent ); + // func( obj, indent ); // Add in the opening bracket and the tag. diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs b/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs index 510ed04..3c7f8bf 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs +++ b/src/coreclr/src/mscorlib/src/System/Security/SecurityState.cs @@ -14,13 +14,10 @@ namespace System.Security public bool IsStateAvailable() { AppDomainManager domainManager = AppDomainManager.CurrentAppDomainManager; -#if FEATURE_CORECLR + // CheckSecuritySettings only when appdomainManager is present. So if there is no // appDomain Manager return true as by default coreclr runs in fulltrust. return domainManager != null ? domainManager.CheckSecuritySettings(this) : true; -#else - return domainManager != null ? domainManager.CheckSecuritySettings(this) : false; -#endif } // override this function and throw the appropriate public abstract void EnsureState(); diff --git a/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs b/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs index 74a25b5..97121f6 100644 --- a/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs +++ b/src/coreclr/src/mscorlib/src/System/String.Manipulation.cs @@ -1125,14 +1125,8 @@ namespace System bool omitEmptyEntries = (options == StringSplitOptions.RemoveEmptyEntries); if ((count == 0) || (omitEmptyEntries && this.Length == 0)) - { -#if FEATURE_CORECLR + { return EmptyArray.Value; -#else - // Keep the old behavior of returning a new empty array - // to mitigate any potential compat risk. - return new String[0]; -#endif } if (count == 1) @@ -1140,13 +1134,13 @@ namespace System return new String[] { this }; } - int[] sepList = new int[Length]; + int[] sepList = new int[Length]; int numReplaces = MakeSeparatorList(separators, separatorsLength, sepList); // Handle the special case of no replaces. if (0 == numReplaces) { return new String[] { this }; - } + } if(omitEmptyEntries) { @@ -1155,7 +1149,7 @@ namespace System else { return SplitKeepEmptyEntries(sepList, null, 1, numReplaces, count); - } + } } [ComVisible(false)] @@ -1203,13 +1197,7 @@ namespace System } if ((count == 0) || (omitEmptyEntries && this.Length ==0)) { -#if FEATURE_CORECLR return EmptyArray.Value; -#else - // Keep the old behavior of returning a new empty array - // to mitigate any potential compat risk. - return new String[0]; -#endif } if (count == 1 || (singleSeparator && separator.Length == 0)) { diff --git a/src/coreclr/src/mscorlib/src/System/String.cs b/src/coreclr/src/mscorlib/src/System/String.cs index 5e24158..44565dc 100644 --- a/src/coreclr/src/mscorlib/src/System/String.cs +++ b/src/coreclr/src/mscorlib/src/System/String.cs @@ -144,12 +144,8 @@ namespace System { } return chars; } - -#if FEATURE_CORECLR + return Array.Empty(); -#else - return new char[0]; -#endif } // Returns a substring of this string as an array of characters. @@ -172,12 +168,8 @@ namespace System { } return chars; } - -#if FEATURE_CORECLR + return Array.Empty(); -#else - return new char[0]; -#endif } [Pure] diff --git a/src/coreclr/src/mscorlib/src/System/StubHelpers.cs b/src/coreclr/src/mscorlib/src/System/StubHelpers.cs index 04d6581..806c19b 100644 --- a/src/coreclr/src/mscorlib/src/System/StubHelpers.cs +++ b/src/coreclr/src/mscorlib/src/System/StubHelpers.cs @@ -1516,44 +1516,6 @@ namespace System.StubHelpers { #endif } // struct NativeVariant -#if !BIT64 && !FEATURE_CORECLR - // Structure filled by IL stubs if copy constructor(s) and destructor(s) need to be called - // on value types pushed on the stack. The structure is stored in s_copyCtorStubDesc by - // SetCopyCtorCookieChain and fetched by CopyCtorCallStubWorker. Must be stack-allocated. - [StructLayout(LayoutKind.Sequential)] - unsafe internal struct CopyCtorStubCookie - { - public void SetData(IntPtr srcInstancePtr, uint dstStackOffset, IntPtr ctorPtr, IntPtr dtorPtr) - { - m_srcInstancePtr = srcInstancePtr; - m_dstStackOffset = dstStackOffset; - m_ctorPtr = ctorPtr; - m_dtorPtr = dtorPtr; - } - - public void SetNext(IntPtr pNext) - { - m_pNext = pNext; - } - - public IntPtr m_srcInstancePtr; // pointer to the source instance - public uint m_dstStackOffset; // offset from the start of stack arguments of the pushed 'this' instance - - public IntPtr m_ctorPtr; // fnptr to the managed copy constructor, result of ldftn - public IntPtr m_dtorPtr; // fnptr to the managed destructor, result of ldftn - - public IntPtr m_pNext; // pointer to next cookie in the chain or IntPtr.Zero - } // struct CopyCtorStubCookie - - // Aggregates pointer to CopyCtorStubCookie and the target of the interop call. - [StructLayout(LayoutKind.Sequential)] - unsafe internal struct CopyCtorStubDesc - { - public IntPtr m_pCookie; - public IntPtr m_pTarget; - } // struct CopyCtorStubDes -#endif // !BIT64 && !FEATURE_CORECLR - // Aggregates SafeHandle and the "owned" bit which indicates whether the SafeHandle // has been successfully AddRef'ed. This allows us to do realiable cleanup (Release) // if and only if it is needed. @@ -1609,33 +1571,8 @@ namespace System.StubHelpers { [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern IntPtr GetDelegateTarget(Delegate pThis, ref IntPtr pStubArg); -#if !BIT64 && !FEATURE_CORECLR - // Written to by a managed stub helper, read by CopyCtorCallStubWorker in VM. - [ThreadStatic] - static CopyCtorStubDesc s_copyCtorStubDesc; - - static internal void SetCopyCtorCookieChain(IntPtr pStubArg, IntPtr pUnmngThis, int dwStubFlags, IntPtr pCookie) - { - // we store both the cookie chain head and the target of the copy ctor stub to a thread - // static field to be accessed by the copy ctor (see code:CopyCtorCallStubWorker) - s_copyCtorStubDesc.m_pCookie = pCookie; - s_copyCtorStubDesc.m_pTarget = GetFinalStubTarget(pStubArg, pUnmngThis, dwStubFlags); - } - - // Returns the final unmanaged stub target, ignores interceptors. - [MethodImplAttribute(MethodImplOptions.InternalCall)] - static internal extern IntPtr GetFinalStubTarget(IntPtr pStubArg, IntPtr pUnmngThis, int dwStubFlags); -#endif // !FEATURE_CORECLR && !BIT64 - -#if !FEATURE_CORECLR - [MethodImplAttribute(MethodImplOptions.InternalCall)] - static internal extern void DemandPermission(IntPtr pNMD); -#endif // !FEATURE_CORECLR - -#if FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern void ClearLastError(); -#endif [MethodImplAttribute(MethodImplOptions.InternalCall)] static internal extern void SetLastError(); diff --git a/src/coreclr/src/mscorlib/src/System/Threading/LockRecursionException.cs b/src/coreclr/src/mscorlib/src/System/Threading/LockRecursionException.cs index c5e3146..ab95e70 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/LockRecursionException.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/LockRecursionException.cs @@ -20,9 +20,6 @@ namespace System.Threading [Serializable] [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] -#if !FEATURE_CORECLR - [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif public class LockRecursionException : System.Exception { public LockRecursionException() { } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs b/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs index 1e893ea..5126e22 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs @@ -176,22 +176,14 @@ namespace System.Threading MutexCleanupInfo cleanupInfo = (MutexCleanupInfo) userData; // If hasThreadAffinity isn't true, we've thrown an exception in the above try, and we must free the mutex - // on this OS thread before ending our thread affninity. + // on this OS thread before ending our thread affninity. if(!hasThreadAffinity) { if (cleanupInfo.mutexHandle != null && !cleanupInfo.mutexHandle.IsInvalid) { if( cleanupInfo.inCriticalRegion) { - Win32Native.ReleaseMutex(cleanupInfo.mutexHandle); + Win32Native.ReleaseMutex(cleanupInfo.mutexHandle); } - cleanupInfo.mutexHandle.Dispose(); - + cleanupInfo.mutexHandle.Dispose(); } - - if( cleanupInfo.inCriticalRegion) { -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); - Thread.EndThreadAffinity(); -#endif - } } } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs b/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs index c02f14e..a04a476 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Overlapped.cs @@ -152,11 +152,8 @@ namespace System.Threading #pragma warning restore 169 internal NativeOverlapped m_nativeOverlapped; -#if FEATURE_CORECLR // Adding an empty default ctor for annotation purposes internal OverlappedData(){} -#endif // FEATURE_CORECLR - internal void ReInitialize() { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreFullException.cs b/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreFullException.cs index e1928e0..01c5040 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreFullException.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SemaphoreFullException.cs @@ -9,9 +9,6 @@ namespace System.Threading { [Serializable] [ComVisibleAttribute(false)] -#if !FEATURE_CORECLR - [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif public class SemaphoreFullException : SystemException { public SemaphoreFullException() : base(Environment.GetResourceString("Threading_SemaphoreFullException")){ diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SpinLock.cs b/src/coreclr/src/mscorlib/src/System/Threading/SpinLock.cs index 56ff37a..fbd90a4 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SpinLock.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SpinLock.cs @@ -107,7 +107,6 @@ namespace System.Threading // The waiters count is calculated by m_owner & WAITERS_MASK 01111....110 private static int MAXIMUM_WAITERS = WAITERS_MASK; - /// /// Initializes a new instance of the /// structure with the option to track thread IDs to improve debugging. @@ -127,7 +126,6 @@ namespace System.Threading } } - /// /// Initializes a new instance of the /// structure with the option to track thread IDs to improve debugging. @@ -157,9 +155,6 @@ namespace System.Threading /// public void Enter(ref bool lockTaken) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif //Try to keep the code and branching in this method as small as possible in order to inline the method int observedOwner = m_owner; if (lockTaken || //invalid parameter @@ -256,10 +251,6 @@ namespace System.Threading /// a negative number other than -1, which represents an infinite time-out. public void TryEnter(int millisecondsTimeout, ref bool lockTaken) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif - int observedOwner = m_owner; if (millisecondsTimeout < -1 || //invalid parameter lockTaken || //invalid parameter @@ -277,10 +268,6 @@ namespace System.Threading /// The lockTaken param private void ContinueTryEnter(int millisecondsTimeout, ref bool lockTaken) { - //Leave the critical region which is entered by the fast path -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif // The fast path doesn't throw any exception, so we have to validate the parameters here if (lockTaken) { @@ -294,20 +281,12 @@ namespace System.Threading nameof(millisecondsTimeout), millisecondsTimeout, Environment.GetResourceString("SpinLock_TryEnter_ArgumentOutOfRange")); } - uint startTime = 0; if (millisecondsTimeout != Timeout.Infinite && millisecondsTimeout != 0) { startTime = TimeoutHelper.GetTime(); } -#if !FEATURE_CORECLR - if (CdsSyncEtwBCLProvider.Log.IsEnabled()) - { - CdsSyncEtwBCLProvider.Log.SpinLock_FastPathFailed(m_owner); - } -#endif - if (IsThreadOwnerTrackingEnabled) { // Slow path for enabled thread tracking mode @@ -333,19 +312,12 @@ namespace System.Threading observedOwner = m_owner; if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif - if (Interlocked.CompareExchange(ref m_owner, observedOwner | 1, observedOwner, ref lockTaken) == observedOwner) { // Aquired lock return; } -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif if (millisecondsTimeout == 0) { // Did not aquire lock in CompareExchange and timeout is 0 so fail fast @@ -377,10 +349,6 @@ namespace System.Threading observedOwner = m_owner; if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif - int newOwner = (observedOwner & WAITERS_MASK) == 0 ? // Gets the number of waiters, if zero observedOwner | 1 // don't decrement it. just set the lock bit, it is zzero because a previous call of Exit(false) ehich corrupted the waiters : (observedOwner - 2) | 1; // otherwise decrement the waiters and set the lock bit @@ -390,10 +358,6 @@ namespace System.Threading { return; } - -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif } } @@ -405,7 +369,6 @@ namespace System.Threading } } - //*** Step 3, Yielding //Sleep(1) every 50 yields int yieldsoFar = 0; @@ -414,9 +377,6 @@ namespace System.Threading observedOwner = m_owner; if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif int newOwner = (observedOwner & WAITERS_MASK) == 0 ? // Gets the number of waiters, if zero observedOwner | 1 // don't decrement it. just set the lock bit, it is zzero because a previous call of Exit(false) ehich corrupted the waiters : (observedOwner - 2) | 1; // otherwise decrement the waiters and set the lock bit @@ -426,10 +386,6 @@ namespace System.Threading { return; } - -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif } if (yieldsoFar % SLEEP_ONE_FREQUENCY == 0) @@ -511,17 +467,10 @@ namespace System.Threading if (m_owner == lockUnowned) { -#if !FEATURE_CORECLR - Thread.BeginCriticalRegion(); -#endif if (Interlocked.CompareExchange(ref m_owner, m_newOwner, lockUnowned, ref lockTaken) == lockUnowned) { return; } -#if !FEATURE_CORECLR - // The thread failed to get the lock, so we don't need to remain in a critical region. - Thread.EndCriticalRegion(); -#endif } // Check the timeout. We only RDTSC if the next spin will yield, to amortize the cost. if (millisecondsTimeout == 0 || @@ -551,11 +500,6 @@ namespace System.Threading ExitSlowPath(true); else Interlocked.Decrement(ref m_owner); - -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif - } /// @@ -587,10 +531,6 @@ namespace System.Threading } else ExitSlowPath(useMemoryBarrier); - -#if !FEATURE_CORECLR - Thread.EndCriticalRegion(); -#endif } /// diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SpinWait.cs b/src/coreclr/src/mscorlib/src/System/Threading/SpinWait.cs index 1888b60..cf10fef 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SpinWait.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SpinWait.cs @@ -132,10 +132,6 @@ namespace System.Threading // remove the thread from the scheduler's queue for 10+ms, if the system is // configured to use the (default) coarse-grained system timer. // - -#if !FEATURE_CORECLR - CdsSyncEtwBCLProvider.Log.SpinWait_NextSpinWillYield(); -#endif int yieldsSoFar = (m_count >= YIELD_THRESHOLD ? m_count - YIELD_THRESHOLD : m_count); if ((yieldsSoFar % SLEEP_1_EVERY_HOW_MANY_TIMES) == (SLEEP_1_EVERY_HOW_MANY_TIMES - 1)) diff --git a/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs b/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs index 63e60ba..737ef7d 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs @@ -49,8 +49,6 @@ namespace System.Threading } #endif //FEATURE_COMINTEROP -#if !FEATURE_CORECLR -#endif public class SynchronizationContext { #if FEATURE_SYNCHRONIZATIONCONTEXT_WAIT @@ -171,8 +169,6 @@ namespace System.Threading private static extern int WaitHelperNative(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout); #endif -#if FEATURE_CORECLR - public static void SetSynchronizationContext(SynchronizationContext syncContext) { Thread.CurrentThread.SynchronizationContext = syncContext; @@ -208,49 +204,6 @@ namespace System.Threading } } -#else //FEATURE_CORECLR - - // set SynchronizationContext on the current thread - public static void SetSynchronizationContext(SynchronizationContext syncContext) - { - ExecutionContext ec = Thread.CurrentThread.GetMutableExecutionContext(); - ec.SynchronizationContext = syncContext; - ec.SynchronizationContextNoFlow = syncContext; - } - - // Get the current SynchronizationContext on the current thread - public static SynchronizationContext Current - { - get - { - return Thread.CurrentThread.GetExecutionContextReader().SynchronizationContext ?? GetThreadLocalContext(); - } - } - - // Get the last SynchronizationContext that was set explicitly (not flowed via ExecutionContext.Capture/Run) - internal static SynchronizationContext CurrentNoFlow - { - [FriendAccessAllowed] - get - { - return Thread.CurrentThread.GetExecutionContextReader().SynchronizationContextNoFlow ?? GetThreadLocalContext(); - } - } - - private static SynchronizationContext GetThreadLocalContext() - { - SynchronizationContext context = null; - -#if FEATURE_APPX - if (context == null && AppDomain.IsAppXModel()) - context = GetWinRTContext(); -#endif - - return context; - } - -#endif //FEATURE_CORECLR - #if FEATURE_APPX private static SynchronizationContext GetWinRTContext() { diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs index 8ba126f..84446f6 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs @@ -6985,18 +6985,6 @@ namespace System.Threading.Tasks // that can SO in 20 inlines on a typical 1MB stack size probably needs to be revisited anyway. private const int MAX_UNCHECKED_INLINING_DEPTH = 20; -#if !FEATURE_CORECLR - - private UInt64 m_lastKnownWatermark; - private static int s_pageSize; - - // We are conservative here. We assume that the platform needs a whole 64KB to - // respond to stack overflow. This means that for very small stacks (e.g. 128KB) - // we'll fail a lot of stack checks incorrectly. - private const long STACK_RESERVED_SPACE = 4096 * 16; - -#endif // !FEATURE_CORECLR - /// /// This method needs to be called before attempting inline execution on the current thread. /// If false is returned, it means we are too close to the end of the stack and should give up inlining. @@ -7030,50 +7018,7 @@ namespace System.Threading.Tasks private unsafe bool CheckForSufficientStack() { -#if FEATURE_CORECLR return RuntimeHelpers.TryEnsureSufficientExecutionStack(); -#else - // see if we already have the system page size info recorded - int pageSize = s_pageSize; - if (pageSize == 0) - { - // If not we need to query it from GetSystemInfo() - // Note that this happens only once for the process lifetime - Win32Native.SYSTEM_INFO sysInfo = new Win32Native.SYSTEM_INFO(); - Win32Native.GetSystemInfo(ref sysInfo); - - s_pageSize = pageSize = sysInfo.dwPageSize; - } - - Win32Native.MEMORY_BASIC_INFORMATION stackInfo = new Win32Native.MEMORY_BASIC_INFORMATION(); - - // We subtract one page for our request. VirtualQuery rounds UP to the next page. - // Unfortunately, the stack grows down. If we're on the first page (last page in the - // VirtualAlloc), we'll be moved to the next page, which is off the stack! - - UIntPtr currentAddr = new UIntPtr(&stackInfo - pageSize); - UInt64 current64 = currentAddr.ToUInt64(); - - // Check whether we previously recorded a deeper stack than where we currently are, - // If so we don't need to do the P/Invoke to VirtualQuery - if (m_lastKnownWatermark != 0 && current64 > m_lastKnownWatermark) - return true; - - // Actual stack probe. P/Invoke to query for the current stack allocation information. - Win32Native.VirtualQuery(currentAddr.ToPointer(), ref stackInfo, (UIntPtr)(sizeof(Win32Native.MEMORY_BASIC_INFORMATION))); - - // If the current address minus the base (remember: the stack grows downward in the - // address space) is greater than the number of bytes requested plus the reserved - // space at the end, the request has succeeded. - - if ((current64 - ((UIntPtr)stackInfo.AllocationBase).ToUInt64()) > STACK_RESERVED_SPACE) - { - m_lastKnownWatermark = current64; - return true; - } - - return false; -#endif } } diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs index 5ed67d4..b329b78 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs @@ -64,11 +64,7 @@ namespace System.Threading.Tasks private static bool ShouldFailFastOnUnobservedException() { - bool shouldFailFast = false; - #if !FEATURE_CORECLR - shouldFailFast = System.CLRConfig.CheckThrowUnobservedTaskExceptions(); - #endif - return shouldFailFast; + return false; } private static void EnsureADUnloadCallbackRegistered() diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs b/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs index 0795d53..bf78fd3 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Thread.cs @@ -192,10 +192,8 @@ namespace System.Threading { #endif // FEATURE_LEAK_CULTURE_INFO } -#if FEATURE_CORECLR // Adding an empty default ctor for annotation purposes internal Thread(){} -#endif // FEATURE_CORECLR /*========================================================================= ** Creates a new Thread object which will begin execution at @@ -324,7 +322,6 @@ namespace System.Threading { StartInternal(principal, ref stackMark); } -#if FEATURE_CORECLR internal ExecutionContext ExecutionContext { get { return m_ExecutionContext; } @@ -335,78 +332,7 @@ namespace System.Threading { { get { return m_SynchronizationContext; } set { m_SynchronizationContext = value; } - } -#else // !FEATURE_CORECLR - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - internal ExecutionContext.Reader GetExecutionContextReader() - { - return new ExecutionContext.Reader(m_ExecutionContext); - } - - internal bool ExecutionContextBelongsToCurrentScope - { - get { return !m_ExecutionContextBelongsToOuterScope; } - set { m_ExecutionContextBelongsToOuterScope = !value; } - } - -#if DEBUG - internal bool ForbidExecutionContextMutation - { - set { m_ForbidExecutionContextMutation = value; } - } -#endif - - // note: please don't access this directly from mscorlib. Use GetMutableExecutionContext or GetExecutionContextReader instead. - public ExecutionContext ExecutionContext - { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - get - { - ExecutionContext result; - if (this == Thread.CurrentThread) - result = GetMutableExecutionContext(); - else - result = m_ExecutionContext; - - return result; - } - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - internal ExecutionContext GetMutableExecutionContext() - { - Contract.Assert(Thread.CurrentThread == this); -#if DEBUG - Contract.Assert(!m_ForbidExecutionContextMutation); -#endif - if (m_ExecutionContext == null) - { - m_ExecutionContext = new ExecutionContext(); - } - else if (!ExecutionContextBelongsToCurrentScope) - { - ExecutionContext copy = m_ExecutionContext.CreateMutableCopy(); - m_ExecutionContext = copy; - } - - ExecutionContextBelongsToCurrentScope = true; - return m_ExecutionContext; - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - internal void SetExecutionContext(ExecutionContext value, bool belongsToCurrentScope) - { - m_ExecutionContext = value; - ExecutionContextBelongsToCurrentScope = belongsToCurrentScope; - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - internal void SetExecutionContext(ExecutionContext.Reader value, bool belongsToCurrentScope) - { - m_ExecutionContext = value.DangerousGetRawExecutionContext(); - ExecutionContextBelongsToCurrentScope = belongsToCurrentScope; } -#endif //!FEATURE_CORECLR [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void StartInternal(IPrincipal principal, ref StackCrawlMark stackMark); @@ -456,27 +382,9 @@ namespace System.Threading { ** If Abort is called twice on the same thread, a DuplicateThreadAbort ** exception is thrown. =========================================================================*/ - -#if !FEATURE_CORECLR - public void Abort(Object stateInfo) - { - // If two aborts come at the same time, it is possible that the state info - // gets set by one, and the actual abort gets delivered by another. But this - // is not distinguishable by an application. - // The accessor helper will only set the value if it isn't already set, - // and that particular bit of native code can test much faster than this - // code could, because testing might cause a cross-appdomain marshalling. - AbortReason = stateInfo; - - // Note: we demand ControlThread permission, then call AbortInternal directly - // rather than delegating to the Abort() function below. We do this to ensure - // that only callers with ControlThread are allowed to change the AbortReason - // of the thread. We call AbortInternal directly to avoid demanding the same - // permission twice. - AbortInternal(); - } -#endif - +#pragma warning disable 618 + [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)] +#pragma warning restore 618 public void Abort() { AbortInternal(); @@ -487,115 +395,6 @@ namespace System.Threading { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void AbortInternal(); -#if !FEATURE_CORECLR - /*========================================================================= - ** Resets a thread abort. - ** Should be called by trusted code only - =========================================================================*/ - public static void ResetAbort() - { - Thread thread = Thread.CurrentThread; - if ((thread.ThreadState & ThreadState.AbortRequested) == 0) - throw new ThreadStateException(Environment.GetResourceString("ThreadState_NoAbortRequested")); - thread.ResetAbortNative(); - thread.ClearAbortReason(); - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void ResetAbortNative(); - - /*========================================================================= - ** Suspends the thread. If the thread is already suspended, this call has - ** no effect. - ** - ** Exceptions: ThreadStateException if the thread has not been started or - ** it is dead. - =========================================================================*/ - public void Suspend() { SuspendInternal(); } - - // Internal helper (since we can't place security demands on - // ecalls/fcalls). - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void SuspendInternal(); - - /*========================================================================= - ** Resumes a thread that has been suspended. - ** - ** Exceptions: ThreadStateException if the thread has not been started or - ** it is dead or it isn't in the suspended state. - =========================================================================*/ - [Obsolete("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)] - public void Resume() { ResumeInternal(); } - - // Internal helper (since we can't place security demands on - // ecalls/fcalls). - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void ResumeInternal(); - - /*========================================================================= - ** Interrupts a thread that is inside a Wait(), Sleep() or Join(). If that - ** thread is not currently blocked in that manner, it will be interrupted - ** when it next begins to block. - =========================================================================*/ - public new void Interrupt() => base.Interrupt(); - - /*========================================================================= - ** Returns the priority of the thread. - ** - ** Exceptions: ThreadStateException if the thread is dead. - =========================================================================*/ - - public new ThreadPriority Priority - { - get - { - return base.Priority; - } - [HostProtection(SelfAffectingThreading = true)] - set - { - base.Priority = value; - } - } - - /*========================================================================= - ** Returns true if the thread has been started and is not dead. - =========================================================================*/ - public new bool IsAlive - { - get - { - return base.IsAlive; - } - } - - /*========================================================================= - ** Returns true if the thread is a threadpool thread. - =========================================================================*/ - public new bool IsThreadPoolThread - { - get - { - return base.IsThreadPoolThread; - } - } - - /*========================================================================= - ** Waits for the thread to die or for timeout milliseconds to elapse. - ** Returns true if the thread died, or false if the wait timed out. If - ** Timeout.Infinite is given as the parameter, no timeout will occur. - ** - ** Exceptions: ArgumentException if timeout < 0. - ** ThreadInterruptedException if the thread is interrupted while waiting. - ** ThreadStateException if the thread has not been started yet. - =========================================================================*/ - [HostProtection(Synchronization = true, ExternalThreading = true)] - public new void Join() => base.Join(); - - [HostProtection(Synchronization = true, ExternalThreading = true)] - public new bool Join(int millisecondsTimeout) => base.Join(millisecondsTimeout); -#endif // !FEATURE_CORECLR - [HostProtection(Synchronization=true, ExternalThreading=true)] public bool Join(TimeSpan timeout) { @@ -675,25 +474,8 @@ namespace System.Threading { private void SetStartHelper(Delegate start, int maxStackSize) { -#if FEATURE_CORECLR // We only support default stacks in CoreCLR Contract.Assert(maxStackSize == 0); -#else - // Only fully-trusted code is allowed to create "large" stacks. Partial-trust falls back to - // the default stack size. - ulong defaultStackSize = GetProcessDefaultStackSize(); - if ((ulong)(uint)maxStackSize > defaultStackSize) - { - try - { - SecurityPermission.Demand(PermissionType.FullTrust); - } - catch (SecurityException) - { - maxStackSize = (int)Math.Min(defaultStackSize, (ulong)(uint)int.MaxValue); - } - } -#endif ThreadHelper threadStartCallBack = new ThreadHelper(start); if(start is ThreadStart) @@ -731,47 +513,6 @@ namespace System.Threading { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void InternalFinalize(); -#if !FEATURE_CORECLR -#if FEATURE_COMINTEROP - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - public new void DisableComObjectEagerCleanup() - { - base.DisableComObjectEagerCleanup(); - } -#endif // FEATURE_COMINTEROP - - /*========================================================================= - ** Return whether or not this thread is a background thread. Background - ** threads do not affect when the Execution Engine shuts down. - ** - ** Exceptions: ThreadStateException if the thread is dead. - =========================================================================*/ - public new bool IsBackground - { - get - { - return base.IsBackground; - } - [HostProtection(SelfAffectingThreading = true)] - set - { - base.IsBackground = value; - } - } - - /*========================================================================= - ** Return the thread state as a consistent set of bits. This is more - ** general then IsAlive or IsBackground. - =========================================================================*/ - public new ThreadState ThreadState - { - get - { - return base.ThreadState; - } - } -#endif // !FEATURE_CORECLR - #if FEATURE_COMINTEROP_APARTMENT_SUPPORT /*========================================================================= ** An unstarted thread can be marked to indicate that it will host a @@ -795,13 +536,6 @@ namespace System.Threading { } } -#if !FEATURE_CORECLR - public new ApartmentState GetApartmentState() => base.GetApartmentState(); - - [HostProtection(Synchronization=true, SelfAffectingThreading=true)] - public new bool TrySetApartmentState(ApartmentState state) => base.TrySetApartmentState(state); -#endif // !FEATURE_CORECLR - [HostProtection(Synchronization=true, SelfAffectingThreading=true)] public void SetApartmentState(ApartmentState state) { @@ -1198,38 +932,6 @@ namespace System.Threading { set { SetAbortReason(value); } } -#if !FEATURE_CORECLR - /* - * This marks the beginning of a critical code region. - */ - [HostProtection(Synchronization=true, ExternalThreading=true)] - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - public static extern void BeginCriticalRegion(); - - /* - * This marks the end of a critical code region. - */ - [HostProtection(Synchronization=true, ExternalThreading=true)] - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - public static extern void EndCriticalRegion(); - - /* - * This marks the beginning of a code region that requires thread affinity. - */ - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - public static extern void BeginThreadAffinity(); - - /* - * This marks the end of a code region that requires thread affinity. - */ - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - public static extern void EndThreadAffinity(); -#endif // !FEATURE_CORECLR - /*========================================================================= ** Volatile Read & Write and MemoryBarrier methods. ** Provides the ability to read and write values ensuring that the values @@ -1457,28 +1159,6 @@ namespace System.Threading { } } -#if !FEATURE_CORECLR - void _Thread.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _Thread.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _Thread.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - void _Thread.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - // Helper function to set the AbortReason for a thread abort. // Checks that they're not alredy set, and then atomically updates // the reason info (object + ADID). diff --git a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs index 3debaf0..7638c8b 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs @@ -27,7 +27,7 @@ namespace System.Threading using System.Diagnostics.CodeAnalysis; using Win32Native = Microsoft.Win32.Win32Native; -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] public abstract class WaitHandle : MarshalByRefObject, IDisposable { public const int WaitTimeout = 0x102; @@ -76,9 +76,6 @@ namespace System.Threading public virtual IntPtr Handle { get { return safeWaitHandle == null ? InvalidHandle : safeWaitHandle.DangerousGetHandle();} - -#if !FEATURE_CORECLR -#endif set { if (value == InvalidHandle) @@ -103,11 +100,8 @@ namespace System.Threading } } - public SafeWaitHandle SafeWaitHandle { -#if !FEATURE_CORECLR -#endif [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] get { @@ -117,9 +111,7 @@ namespace System.Threading } return safeWaitHandle; } - -#if !FEATURE_CORECLR -#endif + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] set { @@ -273,11 +265,7 @@ namespace System.Threading // in CoreCLR, and ArgumentNullException in the desktop CLR. This is ugly, but so is breaking // user code. // -#if FEATURE_CORECLR throw new ArgumentException(Environment.GetResourceString("Argument_EmptyWaithandleArray")); -#else - throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("Argument_EmptyWaithandleArray")); -#endif } if (waitHandles.Length > MAX_WAITHANDLES) { @@ -520,14 +508,6 @@ namespace System.Threading int ret = SignalAndWaitOne(toSignal.safeWaitHandle,toWaitOn.safeWaitHandle,millisecondsTimeout, toWaitOn.hasThreadAffinity,exitContext); -#if !FEATURE_CORECLR - if(WAIT_FAILED != ret && toSignal.hasThreadAffinity) - { - Thread.EndCriticalRegion(); - Thread.EndThreadAffinity(); - } -#endif - if(WAIT_ABANDONED == ret) { ThrowAbandonedMutexException(); diff --git a/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs b/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs index 9c471e3..be91d7c 100644 --- a/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/ThrowHelper.cs @@ -94,8 +94,6 @@ namespace System { throw GetWrongValueTypeArgumentException(value, targetType); } - -#if FEATURE_CORECLR private static ArgumentException GetAddingDuplicateWithKeyArgumentException(object key) { return new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicateWithKey", key)); } @@ -103,7 +101,6 @@ namespace System { internal static void ThrowAddingDuplicateWithKeyArgumentException(object key) { throw GetAddingDuplicateWithKeyArgumentException(key); } -#endif internal static void ThrowKeyNotFoundException() { throw new System.Collections.Generic.KeyNotFoundException(); diff --git a/src/coreclr/src/mscorlib/src/System/TimeSpan.cs b/src/coreclr/src/mscorlib/src/System/TimeSpan.cs index 349da68..a594da2 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeSpan.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeSpan.cs @@ -28,7 +28,7 @@ namespace System { // details of this type should change, or new fields added, we need to remember to add // an appropriate custom ILMarshaler to keep WInRT interop scenarios enabled. // -[System.Runtime.InteropServices.ComVisible(true)] + [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public struct TimeSpan : IComparable , IComparable, IEquatable, IFormattable { @@ -406,24 +406,8 @@ namespace System { // [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework] // "TimeSpan_LegacyFormatMode"=dword:00000001 // -#if !FEATURE_CORECLR - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool LegacyFormatMode(); -#endif // !FEATURE_CORECLR - // - // In Silverlight v4, specifying the APP_EARLIER_THAN_SL4.0 quirks mode allows applications to - // run in v2 - v3 legacy behavior. - // -#if !FEATURE_CORECLR -#endif private static bool GetLegacyFormatMode() { -#if !FEATURE_CORECLR - if (LegacyFormatMode()) // FCALL to check COMPlus_TimeSpan_LegacyFormatMode - return true; - return CompatibilitySwitches.IsNetFx40TimeSpanLegacyFormatMode; -#else return false; -#endif // !FEATURE_CORECLR } private static volatile bool _legacyConfigChecked; diff --git a/src/coreclr/src/mscorlib/src/System/TimeZone.cs b/src/coreclr/src/mscorlib/src/System/TimeZone.cs index 602e86a..c0a369f 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZone.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZone.cs @@ -26,10 +26,8 @@ namespace System { using System.Globalization; [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] -#if FEATURE_CORECLR + [System.Runtime.InteropServices.ComVisible(true)] [Obsolete("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")] -#endif public abstract class TimeZone { private static volatile TimeZone currentTimeZone = null; diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs index c8f6f8d..241a150 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs @@ -49,12 +49,8 @@ namespace System { NoThrowOnInvalidTime = 2 }; - [Serializable] [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] -#if !FEATURE_CORECLR - [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif sealed public class TimeZoneInfo : IEquatable, ISerializable, IDeserializationCallback { // ---- SECTION: members supporting exposed properties -------------* @@ -3193,9 +3189,6 @@ namespace System { // // // -#if !FEATURE_CORECLR - [FileIOPermissionAttribute(SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.PathDiscovery)] -#endif static private string TryGetLocalizedNameByMuiNativeResource(string resource) { if (String.IsNullOrEmpty(resource)) { return String.Empty; @@ -4428,9 +4421,6 @@ namespace System { ============================================================*/ [Serializable] [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] -#if !FEATURE_CORECLR - [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif sealed public class AdjustmentRule : IEquatable, ISerializable, IDeserializationCallback { @@ -4740,9 +4730,6 @@ namespace System { ============================================================*/ [Serializable] [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] -#if !FEATURE_CORECLR - [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif public struct TransitionTime : IEquatable, ISerializable, IDeserializationCallback { // ---- SECTION: members supporting exposed properties -------------* diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs index 5f8b919..cabcc15 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs @@ -7,9 +7,6 @@ namespace System { using System.Runtime.CompilerServices; [Serializable] -#if !FEATURE_CORECLR - [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")] -#endif [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public class TimeZoneNotFoundException : Exception { public TimeZoneNotFoundException(String message) diff --git a/src/coreclr/src/mscorlib/src/System/Type.cs b/src/coreclr/src/mscorlib/src/System/Type.cs index b0d385b..2d30c4c 100644 --- a/src/coreclr/src/mscorlib/src/System/Type.cs +++ b/src/coreclr/src/mscorlib/src/System/Type.cs @@ -706,8 +706,7 @@ namespace System { return GetProperties(Type.DefaultLookup); } -#if !FEATURE_CORECLR -#endif + // GetNestedTypes() // This set of method will return any nested types that are found inside // of the type. @@ -718,9 +717,6 @@ namespace System abstract public Type[] GetNestedTypes(BindingFlags bindingAttr); -#if !FEATURE_CORECLR - // GetNestedType() -#endif public Type GetNestedType(String name) { return GetNestedType(name,Type.DefaultLookup); @@ -1794,30 +1790,6 @@ namespace System return base.GetType(); } -#if !FEATURE_CORECLR - void _Type.GetTypeInfoCount(out uint pcTInfo) - { - throw new NotImplementedException(); - } - - void _Type.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) - { - throw new NotImplementedException(); - } - - void _Type.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) - { - throw new NotImplementedException(); - } - - // If you implement this method, make sure to include _Type.Invoke in VM\DangerousAPIs.h and - // include _Type in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp. - void _Type.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) - { - throw new NotImplementedException(); - } -#endif - // private convenience data private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; internal const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; diff --git a/src/coreclr/src/mscorlib/src/System/UIntPtr.cs b/src/coreclr/src/mscorlib/src/System/UIntPtr.cs index 77bca0d..eab424f 100644 --- a/src/coreclr/src/mscorlib/src/System/UIntPtr.cs +++ b/src/coreclr/src/mscorlib/src/System/UIntPtr.cs @@ -84,16 +84,12 @@ namespace System { } public unsafe override int GetHashCode() { -#if FEATURE_CORECLR #if BIT64 ulong l = (ulong)m_value; return (unchecked((int)l) ^ (int)(l >> 32)); #else // 32 return unchecked((int)m_value); #endif -#else - return unchecked((int)((long)m_value)) & 0x7fffffff; -#endif } [System.Runtime.Versioning.NonVersionable] diff --git a/src/coreclr/src/mscorlib/src/System/WeakReference.cs b/src/coreclr/src/mscorlib/src/System/WeakReference.cs index b30ea81..df3629f 100644 --- a/src/coreclr/src/mscorlib/src/System/WeakReference.cs +++ b/src/coreclr/src/mscorlib/src/System/WeakReference.cs @@ -17,9 +17,8 @@ namespace System { using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Diagnostics.Contracts; + [System.Runtime.InteropServices.ComVisible(true)] -#if !FEATURE_CORECLR -#endif [Serializable] public class WeakReference : ISerializable { @@ -27,14 +26,12 @@ namespace System { // This field is not a regular GC handle. It can have a special values that are used to prevent a race condition between setting the target and finalization. internal IntPtr m_handle; - -#if FEATURE_CORECLR + // Migrating InheritanceDemands requires this default ctor, so we can mark it SafeCritical protected WeakReference() { Contract.Assert(false, "WeakReference's protected default ctor should never be used!"); throw new NotImplementedException(); } -#endif // Creates a new WeakReference that keeps track of target. // Assumes a Short Weak Reference (ie TrackResurrection is false.) diff --git a/src/coreclr/src/mscorlib/src/mscorlib.Friends.cs b/src/coreclr/src/mscorlib/src/mscorlib.Friends.cs index fc8ed53..0e55301 100644 --- a/src/coreclr/src/mscorlib/src/mscorlib.Friends.cs +++ b/src/coreclr/src/mscorlib/src/mscorlib.Friends.cs @@ -3,10 +3,8 @@ // See the LICENSE file in the project root for more information. using System.Runtime.CompilerServices; -#if FEATURE_CORECLR // We need this to be able to typeforward to internal types [assembly: InternalsVisibleTo("mscorlib, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab", AllInternalsVisible=false)] -#endif // For now we are only moving to using this file over AssemblyAttributes.cspp in CoreSys, ideally we would move away from the centralized // AssemblyAttributes.cspp model for the other build types at a future point in time. -- 2.7.4