From 4d0313a7041c3a40fc9825bb082fb8295c2a1d0a Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 6 May 2017 11:03:27 -0700 Subject: [PATCH] Delete dead code (dotnet/coreclr#11431) Commit migrated from https://github.com/dotnet/coreclr/commit/3ababc21ab334a2e37c6ba4115c946ea26a6f2fb --- .../src/mscorlib/System.Private.CoreLib.csproj | 5 - .../mscorlib/src/Microsoft/Win32/Win32Native.cs | 1 - src/coreclr/src/mscorlib/src/System/Activator.cs | 258 --------------------- src/coreclr/src/mscorlib/src/System/AppDomain.cs | 122 ---------- src/coreclr/src/mscorlib/src/System/BCLDebug.cs | 1 - .../src/System/DelegateSerializationHolder.cs | 1 - .../src/mscorlib/src/System/Diagnostics/log.cs | 1 - src/coreclr/src/mscorlib/src/System/Empty.cs | 1 - src/coreclr/src/mscorlib/src/System/Environment.cs | 3 - .../src/System/Globalization/EncodingDataItem.cs | 1 - src/coreclr/src/mscorlib/src/System/IO/__Error.cs | 6 - .../mscorlib/src/System/MissingFieldException.cs | 1 - .../mscorlib/src/System/MissingMemberException.cs | 1 - .../src/mscorlib/src/System/OperatingSystem.cs | 154 ------------ src/coreclr/src/mscorlib/src/System/PlatformID.cs | 27 --- .../src/System/Reflection/Assembly.CoreCLR.cs | 20 -- .../src/System/Reflection/RuntimeAssembly.cs | 20 -- src/coreclr/src/mscorlib/src/System/RtType.cs | 1 - .../CompilerServices/RuntimeWrappedException.cs | 1 - .../Runtime/InteropServices/ComEventsHelper.cs | 1 - .../src/System/Runtime/InteropServices/Marshal.cs | 1 - .../src/System/Runtime/Remoting/ObjectHandle.cs | 40 ---- .../Runtime/Serialization/FormatterServices.cs | 1 - .../Runtime/Serialization/SerializationInfo.cs | 1 - .../src/mscorlib/src/System/SharedStatics.cs | 1 - .../src/mscorlib/src/System/Text/Encoding.cs | 1 - .../src/mscorlib/src/System/Threading/Monitor.cs | 1 - .../mscorlib/src/System/Threading/WaitHandle.cs | 1 - .../src/mscorlib/src/System/TypeLoadException.cs | 1 - src/coreclr/src/vm/assemblynative.cpp | 104 --------- src/coreclr/src/vm/assemblynative.hpp | 7 - src/coreclr/src/vm/ecalllist.h | 1 - 32 files changed, 786 deletions(-) delete mode 100644 src/coreclr/src/mscorlib/src/System/OperatingSystem.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/PlatformID.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs diff --git a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj index 945738e..426ae7d 100644 --- a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj @@ -344,9 +344,7 @@ - - @@ -592,9 +590,6 @@ - - - diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs index 8145a95..94e990a 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs @@ -93,7 +93,6 @@ namespace Microsoft.Win32 using System.Security; using System.Text; using System.Configuration.Assemblies; - using System.Runtime.Remoting; using System.Runtime.InteropServices; using System.Threading; using Microsoft.Win32.SafeHandles; diff --git a/src/coreclr/src/mscorlib/src/System/Activator.cs b/src/coreclr/src/mscorlib/src/System/Activator.cs index 34c6ea5..d11739b 100644 --- a/src/coreclr/src/mscorlib/src/System/Activator.cs +++ b/src/coreclr/src/mscorlib/src/System/Activator.cs @@ -16,7 +16,6 @@ namespace System { using System; using System.Reflection; - using System.Runtime.Remoting; using System.Security; using CultureInfo = System.Globalization.CultureInfo; using Evidence = System.Security.Policy.Evidence; @@ -113,47 +112,6 @@ namespace System return Activator.CreateInstance(type, false); } - /* - * Create an instance using the name of type and the assembly where it exists. This allows - * types to be created remotely without having to load the type locally. - */ - - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - static public ObjectHandle CreateInstance(String assemblyName, - String typeName) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return CreateInstance(assemblyName, - typeName, - false, - Activator.ConstructorDefault, - null, - null, - null, - null, - null, - ref stackMark); - } - - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - static public ObjectHandle CreateInstance(String assemblyName, - String typeName, - Object[] activationAttributes) - - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return CreateInstance(assemblyName, - typeName, - false, - Activator.ConstructorDefault, - null, - null, - null, - activationAttributes, - null, - ref stackMark); - } - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod static public Object CreateInstance(Type type, bool nonPublic) { @@ -185,221 +143,5 @@ namespace System // Skip the CreateInstanceCheckThis call to avoid perf cost and to maintain compatibility with V2 (throwing the same exceptions). return (T)rt.CreateInstanceDefaultCtor(true /*publicOnly*/, true /*skipCheckThis*/, true /*fillCache*/, ref stackMark); } - - static public ObjectHandle CreateInstanceFrom(String assemblyFile, - String typeName) - - { - return CreateInstanceFrom(assemblyFile, typeName, null); - } - - static public ObjectHandle CreateInstanceFrom(String assemblyFile, - String typeName, - Object[] activationAttributes) - - { - return CreateInstanceFrom(assemblyFile, - typeName, - false, - Activator.ConstructorDefault, - null, - null, - null, - activationAttributes); - } - - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - public static ObjectHandle CreateInstance(string assemblyName, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return CreateInstance(assemblyName, - typeName, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes, - null, - ref stackMark); - } - - static internal ObjectHandle CreateInstance(String assemblyString, - String typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - Object[] args, - CultureInfo culture, - Object[] activationAttributes, - Evidence securityInfo, - ref StackCrawlMark stackMark) - { - Type type = null; - Assembly assembly = null; - if (assemblyString == null) - { - assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark); - } - else - { - RuntimeAssembly assemblyFromResolveEvent; - AssemblyName assemblyName = RuntimeAssembly.CreateAssemblyName(assemblyString, false /*forIntrospection*/, out assemblyFromResolveEvent); - if (assemblyFromResolveEvent != null) - { - // Assembly was resolved via AssemblyResolve event - assembly = assemblyFromResolveEvent; - } - else if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime) - { - // WinRT type - we have to use Type.GetType - type = Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, ignoreCase); - } - else - { - // Classic managed type - assembly = RuntimeAssembly.InternalLoadAssemblyName( - assemblyName, securityInfo, null, ref stackMark, - true /*thrownOnFileNotFound*/, false /*forIntrospection*/); - } - } - - if (type == null) - { - // It's classic managed type (not WinRT type) - Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyString); - if (assembly == null) return null; - - type = assembly.GetType(typeName, true /*throwOnError*/, ignoreCase); - } - - Object o = Activator.CreateInstance(type, - bindingAttr, - binder, - args, - culture, - activationAttributes); - - Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName); - if (o == null) - return null; - else - { - ObjectHandle Handle = new ObjectHandle(o); - return Handle; - } - } - - public static ObjectHandle CreateInstanceFrom(string assemblyFile, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - return CreateInstanceFromInternal(assemblyFile, - typeName, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes, - null); - } - - private static ObjectHandle CreateInstanceFromInternal(String assemblyFile, - String typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - Object[] args, - CultureInfo culture, - Object[] activationAttributes, - Evidence securityInfo) - { -#pragma warning disable 618 - Assembly assembly = Assembly.LoadFrom(assemblyFile, securityInfo); -#pragma warning restore 618 - Type t = assembly.GetType(typeName, true, ignoreCase); - - Object o = Activator.CreateInstance(t, - bindingAttr, - binder, - args, - culture, - activationAttributes); - - Log(o != null, "CreateInstanceFrom:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName); - if (o == null) - return null; - else - { - ObjectHandle Handle = new ObjectHandle(o); - return Handle; - } - } - - public static ObjectHandle CreateComInstanceFrom(String assemblyName, - String typeName) - { - return CreateComInstanceFrom(assemblyName, - typeName, - null, - AssemblyHashAlgorithm.None); - } - - public static ObjectHandle CreateComInstanceFrom(String assemblyName, - String typeName, - byte[] hashValue, - AssemblyHashAlgorithm hashAlgorithm) - { - Assembly assembly = Assembly.LoadFrom(assemblyName, hashValue, hashAlgorithm); - - Type t = assembly.GetType(typeName, true, false); - - Object[] Attr = t.GetCustomAttributes(typeof(ComVisibleAttribute), false); - if (Attr.Length > 0) - { - if (((ComVisibleAttribute)Attr[0]).Value == false) - throw new TypeLoadException(SR.Argument_TypeMustBeVisibleFromCom); - } - - Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyName); - - if (assembly == null) return null; - - - Object o = Activator.CreateInstance(t, - Activator.ConstructorDefault, - null, - null, - null, - null); - - Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName); - if (o == null) - return null; - else - { - ObjectHandle Handle = new ObjectHandle(o); - return Handle; - } - } - - [System.Diagnostics.Conditional("_DEBUG")] - private static void Log(bool test, string title, string success, string failure) - { - } } } - diff --git a/src/coreclr/src/mscorlib/src/System/AppDomain.cs b/src/coreclr/src/mscorlib/src/System/AppDomain.cs index 02a473c..edd53b2 100644 --- a/src/coreclr/src/mscorlib/src/System/AppDomain.cs +++ b/src/coreclr/src/mscorlib/src/System/AppDomain.cs @@ -25,7 +25,6 @@ namespace System using System.Collections.Generic; using System.Threading; using System.Runtime.InteropServices; - using System.Runtime.Remoting; using System.Reflection.Emit; using CultureInfo = System.Globalization.CultureInfo; using System.IO; @@ -258,18 +257,6 @@ namespace System private static extern APPX_FLAGS nGetAppXFlags(); #endif - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SuppressUnmanagedCodeSecurity] - private static extern void GetAppDomainManagerType(AppDomainHandle domain, - StringHandleOnStack retAssembly, - StringHandleOnStack retType); - - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - [SuppressUnmanagedCodeSecurity] - private static extern void SetAppDomainManagerType(AppDomainHandle domain, - string assembly, - string type); - [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void SetSecurityHomogeneousFlag(AppDomainHandle domain, @@ -328,54 +315,6 @@ namespace System SetupBindingPaths(trustedPlatformAssemblies, platformResourceRoots, appPaths, appNiPaths, appLocalWinMD); } - string domainManagerAssembly; - string domainManagerType; - GetAppDomainManagerType(out domainManagerAssembly, out domainManagerType); - - if (domainManagerAssembly != null && domainManagerType != null) - { - try - { - _domainManager = CreateInstanceAndUnwrap(domainManagerAssembly, domainManagerType) as AppDomainManager; - } - catch (FileNotFoundException e) - { - throw new TypeLoadException(SR.Argument_NoDomainManager, e); - } - catch (SecurityException e) - { - throw new TypeLoadException(SR.Argument_NoDomainManager, e); - } - catch (TypeLoadException e) - { - throw new TypeLoadException(SR.Argument_NoDomainManager, e); - } - - if (_domainManager == null) - { - throw new TypeLoadException(SR.Argument_NoDomainManager); - } - - // If this domain was not created by a managed call to CreateDomain, then the AppDomainSetup - // will not have the correct values for the AppDomainManager set. - FusionStore.AppDomainManagerAssembly = domainManagerAssembly; - FusionStore.AppDomainManagerType = domainManagerType; - - bool notifyFusion = _domainManager.GetType() != typeof(System.AppDomainManager) && !DisableFusionUpdatesFromADManager(); - - - - AppDomainSetup FusionStoreOld = null; - if (notifyFusion) - FusionStoreOld = new AppDomainSetup(FusionStore, true); - - // Initialize the AppDomainMAnager and register the instance with the native host if requested - _domainManager.InitializeNewDomain(FusionStore); - - if (notifyFusion) - SetupFusionStore(_FusionStore, FusionStoreOld); // Notify Fusion about the changes the user implementation of InitializeNewDomain may have made to the FusionStore object. - } - InitializeCompatibilityFlags(); } @@ -485,34 +424,6 @@ namespace System } /// - /// Get the name of the assembly and type that act as the AppDomainManager for this domain - /// - internal void GetAppDomainManagerType(out string assembly, out string type) - { - // We can't just use our parameters because we need to ensure that the strings used for hte QCall - // are on the stack. - string localAssembly = null; - string localType = null; - - GetAppDomainManagerType(GetNativeHandle(), - JitHelpers.GetStringHandleOnStack(ref localAssembly), - JitHelpers.GetStringHandleOnStack(ref localType)); - - assembly = localAssembly; - type = localType; - } - - /// - /// Set the assembly and type which act as the AppDomainManager for this domain - /// - private void SetAppDomainManagerType(string assembly, string type) - { - Debug.Assert(assembly != null, "assembly != null"); - Debug.Assert(type != null, "type != null"); - SetAppDomainManagerType(GetNativeHandle(), assembly, type); - } - - /// /// Called for every AppDomain (including the default domain) to initialize the security of the AppDomain) /// private void InitializeDomainSecurity(Evidence providedSecurityInfo, @@ -584,23 +495,6 @@ namespace System } } - - public ObjectHandle CreateInstance(String assemblyName, - String typeName) - - { - // jit does not check for that, so we should do it ... - if (this == null) - throw new NullReferenceException(); - - if (assemblyName == null) - throw new ArgumentNullException(nameof(assemblyName)); - Contract.EndContractBlock(); - - return Activator.CreateInstance(assemblyName, - typeName); - } - public static AppDomain CurrentDomain { get @@ -1158,12 +1052,6 @@ namespace System } #endif // FEATURE_COMINTEROP - // set up the AppDomainManager for this domain and initialize security. - if (adSetup.AppDomainManagerAssembly != null && adSetup.AppDomainManagerType != null) - { - ad.SetAppDomainManagerType(adSetup.AppDomainManagerAssembly, adSetup.AppDomainManagerType); - } - ad.CreateAppDomainManager(); // could modify FusionStore's object ad.InitializeDomainSecurity(providedSecurityInfo, creatorsSecurityInfo, @@ -1301,16 +1189,6 @@ namespace System } } - public Object CreateInstanceAndUnwrap(String assemblyName, - String typeName) - { - ObjectHandle oh = CreateInstance(assemblyName, typeName); - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - public Int32 Id { get diff --git a/src/coreclr/src/mscorlib/src/System/BCLDebug.cs b/src/coreclr/src/mscorlib/src/System/BCLDebug.cs index 67f7c9a..12a0d55 100644 --- a/src/coreclr/src/mscorlib/src/System/BCLDebug.cs +++ b/src/coreclr/src/mscorlib/src/System/BCLDebug.cs @@ -15,7 +15,6 @@ namespace System { using System.IO; using System.Text; - using System.Runtime.Remoting; using System.Diagnostics; using Microsoft.Win32; using System.Runtime.CompilerServices; diff --git a/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs b/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs index d7ad827..17e2dd9 100644 --- a/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs +++ b/src/coreclr/src/mscorlib/src/System/DelegateSerializationHolder.cs @@ -5,7 +5,6 @@ using System; using System.Reflection; -using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Globalization; using System.Diagnostics.Contracts; diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs index b62ea49..9ec0cfc 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/log.cs @@ -4,7 +4,6 @@ namespace System.Diagnostics { - using System.Runtime.Remoting; using System; using System.IO; using System.Collections; diff --git a/src/coreclr/src/mscorlib/src/System/Empty.cs b/src/coreclr/src/mscorlib/src/System/Empty.cs index 502e8df..7c4503e 100644 --- a/src/coreclr/src/mscorlib/src/System/Empty.cs +++ b/src/coreclr/src/mscorlib/src/System/Empty.cs @@ -9,7 +9,6 @@ using System.Diagnostics.Contracts; using System; -using System.Runtime.Remoting; using System.Runtime.Serialization; namespace System diff --git a/src/coreclr/src/mscorlib/src/System/Environment.cs b/src/coreclr/src/mscorlib/src/System/Environment.cs index dddbdc2..257deb2 100644 --- a/src/coreclr/src/mscorlib/src/System/Environment.cs +++ b/src/coreclr/src/mscorlib/src/System/Environment.cs @@ -77,9 +77,6 @@ namespace System } } - - private static volatile OperatingSystem m_os; // Cached OperatingSystem value - /*==================================TickCount=================================== **Action: Gets the number of ticks since the system was started. **Returns: The number of ticks since the system was started. diff --git a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs index b049eaf..dedcab5 100644 --- a/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs +++ b/src/coreclr/src/mscorlib/src/System/Globalization/EncodingDataItem.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Text; -using System.Runtime.Remoting; using System; using System.Security; diff --git a/src/coreclr/src/mscorlib/src/System/IO/__Error.cs b/src/coreclr/src/mscorlib/src/System/IO/__Error.cs index 70f8326..1af195e 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/__Error.cs +++ b/src/coreclr/src/mscorlib/src/System/IO/__Error.cs @@ -206,11 +206,5 @@ namespace System.IO { throw new NotSupportedException(SR.NotSupported_UnwritableStream); } - - // From WinError.h - internal const int ERROR_FILE_NOT_FOUND = Win32Native.ERROR_FILE_NOT_FOUND; - internal const int ERROR_PATH_NOT_FOUND = Win32Native.ERROR_PATH_NOT_FOUND; - internal const int ERROR_ACCESS_DENIED = Win32Native.ERROR_ACCESS_DENIED; - internal const int ERROR_INVALID_PARAMETER = Win32Native.ERROR_INVALID_PARAMETER; } } diff --git a/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs b/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs index 5668f9e..39f66a2 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs +++ b/src/coreclr/src/mscorlib/src/System/MissingFieldException.cs @@ -11,7 +11,6 @@ using System; -using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Globalization; diff --git a/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs b/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs index 51150e1..0b8342f 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs +++ b/src/coreclr/src/mscorlib/src/System/MissingMemberException.cs @@ -13,7 +13,6 @@ using System; -using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Globalization; diff --git a/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs b/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs deleted file mode 100644 index 5eb1253..0000000 --- a/src/coreclr/src/mscorlib/src/System/OperatingSystem.cs +++ /dev/null @@ -1,154 +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: -** -** -===========================================================*/ - -using System.Runtime.Serialization; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Diagnostics.Contracts; - -namespace System -{ - [Serializable] - internal sealed class OperatingSystem : ICloneable, ISerializable - { - private Version _version; - private PlatformID _platform; - private string _servicePack; - private string _versionString; - - private OperatingSystem() - { - } - - internal OperatingSystem(PlatformID platform, Version version, string servicePack) - { - if (platform < PlatformID.Win32S || platform > PlatformID.MacOSX) - { - throw new ArgumentException( - SR.Format(SR.Arg_EnumIllegalVal, (int)platform), - nameof(platform)); - } - - if ((Object)version == null) - throw new ArgumentNullException(nameof(version)); - Contract.EndContractBlock(); - - _platform = platform; - _version = (Version)version.Clone(); - _servicePack = servicePack; - } - - private OperatingSystem(SerializationInfo info, StreamingContext context) - { - SerializationInfoEnumerator enumerator = info.GetEnumerator(); - while (enumerator.MoveNext()) - { - switch (enumerator.Name) - { - case "_version": - _version = (Version)info.GetValue("_version", typeof(Version)); - break; - case "_platform": - _platform = (PlatformID)info.GetValue("_platform", typeof(PlatformID)); - break; - case "_servicePack": - _servicePack = info.GetString("_servicePack"); - break; - } - } - - if (_version == null) - { - throw new SerializationException(SR.Format(SR.Serialization_MissField, "_version")); - } - } - - public void GetObjectData(SerializationInfo info, StreamingContext context) - { - if (info == null) - { - throw new ArgumentNullException(nameof(info)); - } - Contract.EndContractBlock(); - - info.AddValue("_version", _version); - info.AddValue("_platform", _platform); - info.AddValue("_servicePack", _servicePack); - } - - public Version Version - { - get { return _version; } - } - - public Object Clone() - { - return new OperatingSystem(_platform, - _version, _servicePack); - } - - public override String ToString() - { - return VersionString; - } - - public String VersionString - { - get - { - if (_versionString != null) - { - return _versionString; - } - - String os; - switch (_platform) - { - case PlatformID.Win32NT: - os = "Microsoft Windows NT "; - break; - case PlatformID.Win32Windows: - if ((_version.Major > 4) || - ((_version.Major == 4) && (_version.Minor > 0))) - os = "Microsoft Windows 98 "; - else - os = "Microsoft Windows 95 "; - break; - case PlatformID.Win32S: - os = "Microsoft Win32S "; - break; - case PlatformID.WinCE: - os = "Microsoft Windows CE "; - break; - case PlatformID.MacOSX: - os = "Mac OS X "; - break; - default: - os = " "; - break; - } - - if (String.IsNullOrEmpty(_servicePack)) - { - _versionString = os + _version.ToString(); - } - else - { - _versionString = os + _version.ToString(3) + " " + _servicePack; - } - - return _versionString; - } - } - } -} diff --git a/src/coreclr/src/mscorlib/src/System/PlatformID.cs b/src/coreclr/src/mscorlib/src/System/PlatformID.cs deleted file mode 100644 index dfab217..0000000 --- a/src/coreclr/src/mscorlib/src/System/PlatformID.cs +++ /dev/null @@ -1,27 +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: Defines IDs for supported platforms -** -** -===========================================================*/ - -namespace System -{ - [Serializable] - internal enum PlatformID - { - Win32S = 0, - Win32Windows = 1, - Win32NT = 2, - WinCE = 3, - Unix = 4, - Xbox = 5, - MacOSX = 6 - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs b/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs index cfb36e7..9d34b48 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs @@ -87,26 +87,6 @@ namespace System.Reflection return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath); } - // Evidence is protected in Assembly.Load() - [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of LoadFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - internal static Assembly LoadFrom(String assemblyFile, - Evidence securityEvidence) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - - return RuntimeAssembly.InternalLoadFrom( - assemblyFile, - securityEvidence, - null, // hashValue - AssemblyHashAlgorithm.None, - false,// forIntrospection); - ref stackMark); - } - - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod public static Assembly LoadFrom(String assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs index 4632525..cb2d156 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs @@ -320,26 +320,6 @@ namespace System.Reflection return CustomAttributeData.GetCustomAttributesInternal(this); } - [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - internal static RuntimeAssembly InternalLoadFrom(String assemblyFile, - Evidence securityEvidence, - byte[] hashValue, - AssemblyHashAlgorithm hashAlgorithm, - bool forIntrospection, - ref StackCrawlMark stackMark) - { - if (assemblyFile == null) - throw new ArgumentNullException(nameof(assemblyFile)); - - Contract.EndContractBlock(); - - AssemblyName an = new AssemblyName(); - an.CodeBase = assemblyFile; - an.SetHashControl(hashValue, hashAlgorithm); - // The stack mark is used for MDA filtering - return InternalLoadAssemblyName(an, securityEvidence, null, ref stackMark, true /*thrownOnFileNotFound*/, forIntrospection); - } - // Wrapper function to wrap the typical use of InternalLoad. internal static RuntimeAssembly InternalLoad(String assemblyString, Evidence assemblySecurity, diff --git a/src/coreclr/src/mscorlib/src/System/RtType.cs b/src/coreclr/src/mscorlib/src/System/RtType.cs index 3ae2e04..b64f95b 100644 --- a/src/coreclr/src/mscorlib/src/System/RtType.cs +++ b/src/coreclr/src/mscorlib/src/System/RtType.cs @@ -23,7 +23,6 @@ using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Security; using System.Text; -using System.Runtime.Remoting; using MdSigCallingConvention = System.Signature.MdSigCallingConvention; using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache; using System.Runtime.InteropServices; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs index c050000..97365b0 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs @@ -13,7 +13,6 @@ using System; using System.Runtime.Serialization; -using System.Runtime.Remoting; using System.Diagnostics.Contracts; namespace System.Runtime.CompilerServices diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs index 8198d9f..fe69f61 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs @@ -99,7 +99,6 @@ // code:ComEventsMethod.Invoke using System; -using System.Runtime.Remoting; namespace System.Runtime.InteropServices { 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 97f1bc5..13eb953 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs @@ -22,7 +22,6 @@ namespace System.Runtime.InteropServices using System.Security; using System.Text; using System.Threading; - using System.Runtime.Remoting; using System.Runtime.CompilerServices; using System.Globalization; using System.Runtime.ConstrainedExecution; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs deleted file mode 100644 index e76882d..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs +++ /dev/null @@ -1,40 +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. - -/*============================================================ -** -** -** -** ObjectHandle wraps object references. A Handle allows a -** marshal by value object to be returned through an -** indirection allowing the caller to control when the -** object is loaded into their domain. -** -** -===========================================================*/ - -using System; -using System.Runtime.InteropServices; - -namespace System.Runtime.Remoting -{ - public class ObjectHandle - { - private Object WrappedObject; - - private ObjectHandle() - { - } - - internal ObjectHandle(Object o) - { - WrappedObject = o; - } - - internal Object Unwrap() - { - return WrappedObject; - } - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs index 1813932..b49b372 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs @@ -17,7 +17,6 @@ using System.Reflection; using System.Collections; using System.Collections.Generic; using System.Security; -using System.Runtime.Remoting; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading; 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 7fc3ce2..8fb54c7 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -15,7 +15,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using System.Runtime.Remoting; using System.Globalization; using System.Diagnostics; using System.Diagnostics.Contracts; diff --git a/src/coreclr/src/mscorlib/src/System/SharedStatics.cs b/src/coreclr/src/mscorlib/src/System/SharedStatics.cs index a6a04d9..5c37f25 100644 --- a/src/coreclr/src/mscorlib/src/System/SharedStatics.cs +++ b/src/coreclr/src/mscorlib/src/System/SharedStatics.cs @@ -12,7 +12,6 @@ =============================================================================*/ using System.Threading; -using System.Runtime.Remoting; using System.Security; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; diff --git a/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs b/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs index 1591234..5788051 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs +++ b/src/coreclr/src/mscorlib/src/System/Text/Encoding.cs @@ -8,7 +8,6 @@ namespace System.Text using System.Collections; using System.Collections.Generic; using System.Runtime; - using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Globalization; using System.Security; diff --git a/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs b/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs index 3ace333..0df64a5 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs @@ -17,7 +17,6 @@ using System; using System.Runtime; -using System.Runtime.Remoting; using System.Threading; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; diff --git a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs index f3412d2..da4856e 100644 --- a/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs +++ b/src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs @@ -15,7 +15,6 @@ namespace System.Threading { using System.Threading; - using System.Runtime.Remoting; using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs b/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs index 85e1da5..339ba08 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeLoadException.cs @@ -13,7 +13,6 @@ using System; using System.Globalization; -using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; diff --git a/src/coreclr/src/vm/assemblynative.cpp b/src/coreclr/src/vm/assemblynative.cpp index 702c255..e9bcc23 100644 --- a/src/coreclr/src/vm/assemblynative.cpp +++ b/src/coreclr/src/vm/assemblynative.cpp @@ -326,110 +326,6 @@ Assembly* AssemblyNative::LoadFromBuffer(BOOL fForIntrospection, const BYTE* pAs return pAssembly; } -FCIMPL6(Object*, AssemblyNative::LoadImage, U1Array* PEByteArrayUNSAFE, - U1Array* SymByteArrayUNSAFE, Object* securityUNSAFE, - StackCrawlMark* stackMark, CLR_BOOL fForIntrospection, SecurityContextSource securityContextSource) -{ - FCALL_CONTRACT; - - struct _gc - { - U1ARRAYREF PEByteArray; - U1ARRAYREF SymByteArray; - OBJECTREF security; - OBJECTREF Throwable; - OBJECTREF refRetVal; - } gc; - - gc.PEByteArray = (U1ARRAYREF) PEByteArrayUNSAFE; - gc.SymByteArray = (U1ARRAYREF) SymByteArrayUNSAFE; - gc.security = (OBJECTREF) securityUNSAFE; - gc.Throwable = NULL; - gc.refRetVal = NULL; - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - - if (gc.PEByteArray == NULL) - COMPlusThrow(kArgumentNullException, W("ArgumentNull_Array")); - - NewArrayHolder pbSyms; - DWORD cbSyms = 0; - -#ifdef DEBUGGING_SUPPORTED - // If we were given symbols, save a copy of them. - // the debugger, load them now). - if (gc.SymByteArray != NULL) - { - Security::CopyByteArrayToEncoding(&gc.SymByteArray, - &pbSyms, &cbSyms); - - } -#endif // DEBUGGING_SUPPORTED - - Assembly* pAssembly = NULL; - // Pin byte array for loading - { - Wrapper handle( - GetAppDomain()->CreatePinningHandle(gc.PEByteArray)); - - const BYTE *pbImage = gc.PEByteArray->GetDirectConstPointerToNonObjectElements(); - DWORD cbImage = gc.PEByteArray->GetNumComponents(); - pAssembly = LoadFromBuffer(fForIntrospection, pbImage, cbImage, pbSyms, cbSyms, stackMark, OBJECTREFToObject(gc.security), securityContextSource); - } - - - if (pAssembly != NULL) - gc.refRetVal = pAssembly->GetExposedObject(); - - HELPER_METHOD_FRAME_END(); - - return OBJECTREFToObject(gc.refRetVal); -} -FCIMPLEND - -FCIMPL2(Object*, AssemblyNative::LoadFile, StringObject* pathUNSAFE, Object* securityUNSAFE) -{ - FCALL_CONTRACT; - - struct _gc { - OBJECTREF refRetVal; - OBJECTREF refSecurity; - STRINGREF strPath; - } gc; - - gc.refRetVal = NULL; - gc.refSecurity = ObjectToOBJECTREF(securityUNSAFE); - gc.strPath = ObjectToSTRINGREF(pathUNSAFE); - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - if(CorHost2::IsLoadFromBlocked()) - COMPlusThrow(kFileLoadException, FUSION_E_LOADFROM_BLOCKED); - - if (pathUNSAFE == NULL) - COMPlusThrow(kArgumentNullException, W("ArgumentNull_Path")); - - StackSString path; - gc.strPath->GetSString(path); - - Assembly *pAssembly = AssemblySpec::LoadAssembly(path); - - LOG((LF_CLASSLOADER, - LL_INFO100, - "\tLoaded assembly from a file\n")); - - - if (pAssembly != NULL) - gc.refRetVal = (ASSEMBLYREF) pAssembly->GetExposedObject(); - - HELPER_METHOD_FRAME_END(); - - return OBJECTREFToObject(gc.refRetVal); -} -FCIMPLEND - - /* static */ Assembly* AssemblyNative::LoadFromPEImage(ICLRPrivBinder* pBinderContext, PEImage *pILImage, PEImage *pNIImage) { diff --git a/src/coreclr/src/vm/assemblynative.hpp b/src/coreclr/src/vm/assemblynative.hpp index 514589f..71e8b51 100644 --- a/src/coreclr/src/vm/assemblynative.hpp +++ b/src/coreclr/src/vm/assemblynative.hpp @@ -46,10 +46,6 @@ public: static void QCALLTYPE GetExecutingAssembly(QCall::StackCrawlMarkHandle stackMark, QCall::ObjectHandleOnStack retAssembly); - static FCDECL2(Object*, LoadFile, StringObject* pathUNSAFE, - Object* securityUNSAFE); - static FCDECL6(Object*, LoadImage, U1Array* PEByteArrayUNSAFE, U1Array* SymByteArrayUNSAFE, Object* securityUNSAFE, StackCrawlMark* stackMark, CLR_BOOL fForIntrospection, SecurityContextSource securityContextSource); - static FCDECL10(Object*, Load, AssemblyNameBaseObject* assemblyNameUNSAFE, StringObject* codeBaseUNSAFE, Object* securityUNSAFE, @@ -61,9 +57,6 @@ public: CLR_BOOL fSuppressSecurityChecks, INT_PTR ptrLoadContextBinder); - static FCDECL1(FC_BOOL_RET, IsFrameworkAssembly, AssemblyNameBaseObject* refAssemblyNameUNSAFE); - static FCDECL1(FC_BOOL_RET, IsNewPortableAssembly, AssemblyNameBaseObject* refAssemblyNameUNSAFE); - // // instance FCALLs // diff --git a/src/coreclr/src/vm/ecalllist.h b/src/coreclr/src/vm/ecalllist.h index 81bc656..cc6966e 100644 --- a/src/coreclr/src/vm/ecalllist.h +++ b/src/coreclr/src/vm/ecalllist.h @@ -594,7 +594,6 @@ FCFuncStart(gAssemblyFuncs) QCFuncElement("GetVersion", AssemblyNative::GetVersion) FCFuncElement("FCallIsDynamic", AssemblyNative::IsDynamic) FCFuncElement("_nLoad", AssemblyNative::Load) - FCFuncElement("nLoadImage", AssemblyNative::LoadImage) QCFuncElement("GetType", AssemblyNative::GetType) QCFuncElement("GetManifestResourceInfo", AssemblyNative::GetManifestResourceInfo) QCFuncElement("GetModules", AssemblyNative::GetModules) -- 2.7.4