From d13392a9ffa262952d34374621308d0a878cf21e Mon Sep 17 00:00:00 2001 From: James Ko Date: Fri, 20 Jan 2017 23:02:54 -0500 Subject: [PATCH] Delete unused AppDomain{Setup} types/members (#8768) * Delete unused AppDomain members * Delete unused AppDomainSetup members --- src/mscorlib/mscorlib.shared.sources.props | 1 - src/mscorlib/src/System/AppDomain.cs | 1009 ----------------- src/mscorlib/src/System/AppDomainSetup.cs | 377 +----- .../src/System/CompatibilitySwitches.cs | 30 - src/mscorlib/src/System/IAppDomainSetup.cs | 84 -- .../System/Reflection/Emit/ModuleBuilder.cs | 41 - .../src/System/Reflection/Emit/TypeBuilder.cs | 57 - .../InteropServices/RuntimeEnvironment.cs | 15 - .../WindowsRuntime/CustomPropertyImpl.cs | 1 - 9 files changed, 1 insertion(+), 1614 deletions(-) delete mode 100644 src/mscorlib/src/System/IAppDomainSetup.cs diff --git a/src/mscorlib/mscorlib.shared.sources.props b/src/mscorlib/mscorlib.shared.sources.props index 9877112457..95d19fbc36 100644 --- a/src/mscorlib/mscorlib.shared.sources.props +++ b/src/mscorlib/mscorlib.shared.sources.props @@ -264,7 +264,6 @@ - diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs index fe524c4dc5..6811ff9015 100644 --- a/src/mscorlib/src/System/AppDomain.cs +++ b/src/mscorlib/src/System/AppDomain.cs @@ -366,9 +366,6 @@ namespace System string assembly, string type); - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void nSetHostSecurityManagerFlags (HostSecurityManagerOptions flags); - [SuppressUnmanagedCodeSecurity] [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void SetSecurityHomogeneousFlag(AppDomainHandle domain, @@ -505,35 +502,6 @@ namespace System CompatibilitySwitches.InitializeSwitches(); } - // Retrieves a possibly-cached target framework name for this appdomain. This could be set - // either by a host in native, a host in managed using an AppDomainSetup, or by the - // TargetFrameworkAttribute on the executable (VS emits its target framework moniker using this - // attribute starting in version 4). - internal String GetTargetFrameworkName() - { - String targetFrameworkName = _FusionStore.TargetFrameworkName; - - if (targetFrameworkName == null && IsDefaultAppDomain() && !_FusionStore.CheckedForTargetFrameworkName) - { - // This should only be run in the default appdomain. All other appdomains should have - // values copied from the default appdomain and/or specified by the host. - Assembly assembly = Assembly.GetEntryAssembly(); - if (assembly != null) - { - TargetFrameworkAttribute[] attrs = (TargetFrameworkAttribute[])assembly.GetCustomAttributes(typeof(TargetFrameworkAttribute)); - if (attrs != null && attrs.Length > 0) - { - Debug.Assert(attrs.Length == 1); - targetFrameworkName = attrs[0].FrameworkName; - _FusionStore.TargetFrameworkName = targetFrameworkName; - } - } - _FusionStore.CheckedForTargetFrameworkName = true; - } - - return targetFrameworkName; - } - /// /// Returns the setting of the corresponding compatibility config switch (see CreateAppDomainManager for the impact). /// @@ -604,38 +572,6 @@ namespace System #endif } - /// - /// Checks (and throws on failure) if the domain supports Assembly.LoadWithPartialName. - /// - [Pure] - internal static void CheckLoadWithPartialNameSupported(StackCrawlMark stackMark) - { -#if FEATURE_APPX - if (IsAppXModel()) - { - RuntimeAssembly callingAssembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark); - bool callerIsFxAssembly = callingAssembly != null && callingAssembly.IsFrameworkAssembly(); - if (!callerIsFxAssembly) - { - throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "Assembly.LoadWithPartialName")); - } - } -#endif - } - - /// - /// Checks (and throws on failure) if the domain supports DefinePInvokeMethod. - /// - [Pure] - internal static void CheckDefinePInvokeSupported() - { - // We don't want users to use DefinePInvokeMethod in RefEmit to bypass app store validation on allowed native libraries. -#if FEATURE_APPX - if (IsAppXModel()) - throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "DefinePInvokeMethod")); -#endif - } - /// /// Checks (and throws on failure) if the domain supports Assembly.Load(byte[] ...). /// @@ -648,26 +584,6 @@ namespace System #endif } - /// - /// Checks (and throws on failure) if the domain supports AppDomain.CreateDomain. - /// - [Pure] - internal static void CheckCreateDomainSupported() - { -#if FEATURE_APPX - // Can create a new domain in an AppX process only when DevMode is enabled and - // AssemblyLoadingCompat is not enabled (since there is no multi-domain support - // for LoadFrom and LoadFile in AppX. - if(IsAppXModel()) - { - if (!IsAppXDesignMode()) - { - throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "AppDomain.CreateDomain")); - } - } -#endif - } - /// /// Get the name of the assembly and type that act as the AppDomainManager for this domain /// @@ -811,319 +727,6 @@ namespace System } #endif // FEATURE_REFLECTION_ONLY_LOAD - - /********************************************** - * If an AssemblyName has a public key specified, the assembly is assumed - * to have a strong name and a hash will be computed when the assembly - * is saved. - **********************************************/ - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, null, - null, null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - IEnumerable assemblyAttributes) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, - access, - null, null, null, null, null, - ref stackMark, - assemblyAttributes, SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Due to the stack crawl mark - public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, - AssemblyBuilderAccess access, - IEnumerable assemblyAttributes, - SecurityContextSource securityContextSource) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, - access, - null, null, null, null, null, - ref stackMark, - assemblyAttributes, - securityContextSource); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, dir, - null, null, null, null, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - Evidence evidence) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, null, - evidence, null, null, null, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, null, null, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of DefineDynamicAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - Evidence evidence) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, dir, evidence, - null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, dir, null, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - Evidence evidence, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, null, - evidence, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. Please see http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - Evidence evidence, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, access, dir, - evidence, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - Evidence evidence, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions, - bool isSynchronized) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, - access, - dir, - evidence, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - null, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - Evidence evidence, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions, - bool isSynchronized, - IEnumerable assemblyAttributes) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, - access, - dir, - evidence, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - assemblyAttributes, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public AssemblyBuilder DefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - bool isSynchronized, - IEnumerable assemblyAttributes) - { - Contract.Ensures(Contract.Result() != null); - - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return InternalDefineDynamicAssembly(name, - access, - dir, - null, - null, - null, - null, - ref stackMark, - assemblyAttributes, - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - private AssemblyBuilder InternalDefineDynamicAssembly( - AssemblyName name, - AssemblyBuilderAccess access, - String dir, - Evidence evidence, - PermissionSet requiredPermissions, - PermissionSet optionalPermissions, - PermissionSet refusedPermissions, - ref StackCrawlMark stackMark, - IEnumerable assemblyAttributes, - SecurityContextSource securityContextSource) - { - return AssemblyBuilder.InternalDefineDynamicAssembly(name, - access, - dir, - evidence, - requiredPermissions, - optionalPermissions, - refusedPermissions, - ref stackMark, - assemblyAttributes, - securityContextSource); - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern String nApplyPolicy(AssemblyName an); - - // Return the assembly name that results from applying policy. - [ComVisible(false)] - public String ApplyPolicy(String assemblyName) - { - AssemblyName asmName = new AssemblyName(assemblyName); - - byte[] pk = asmName.GetPublicKeyToken(); - if (pk == null) - pk = asmName.GetPublicKey(); - - // Simply-named assemblies cannot have policy, so for those, - // we simply return the passed-in assembly name. - if ((pk == null) || (pk.Length == 0)) - return assemblyName; - else - return nApplyPolicy(asmName); - } - public ObjectHandle CreateInstance(String assemblyName, String typeName) @@ -1163,72 +766,6 @@ namespace System return CreateInstanceFrom(assemblyName, typeName); } -#if FEATURE_COMINTEROP - // The first parameter should be named assemblyFile, but it was incorrectly named in a previous - // release, and the compatibility police won't let us change the name now. - public ObjectHandle CreateComInstanceFrom(String assemblyName, - String typeName) - - { - if (this == null) - throw new NullReferenceException(); - Contract.EndContractBlock(); - - return Activator.CreateComInstanceFrom(assemblyName, - typeName); - } - - public ObjectHandle CreateComInstanceFrom(String assemblyFile, - String typeName, - byte[] hashValue, - AssemblyHashAlgorithm hashAlgorithm) - - { - if (this == null) - throw new NullReferenceException(); - Contract.EndContractBlock(); - - return Activator.CreateComInstanceFrom(assemblyFile, - typeName, - hashValue, - hashAlgorithm); - } - -#endif // FEATURE_COMINTEROP - - public ObjectHandle CreateInstance(String assemblyName, - String typeName, - Object[] activationAttributes) - - { - // 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, - activationAttributes); - } - - public ObjectHandle CreateInstanceFrom(String assemblyFile, - String typeName, - Object[] activationAttributes) - - { - // jit does not check for that, so we should do it ... - if (this == null) - throw new NullReferenceException(); - Contract.EndContractBlock(); - - return Activator.CreateInstanceFrom(assemblyFile, - typeName, - activationAttributes); - } - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] public ObjectHandle CreateInstance(String assemblyName, String typeName, @@ -1261,33 +798,6 @@ namespace System #pragma warning restore 618 } - public ObjectHandle CreateInstance(string assemblyName, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - // 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, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes); - } - internal ObjectHandle InternalCreateInstanceWithNoSecurity (string assemblyName, string typeName, bool ignoreCase, @@ -1332,30 +842,6 @@ namespace System securityAttributes); } - public ObjectHandle CreateInstanceFrom(string assemblyFile, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - // jit does not check for that, so we should do it ... - if (this == null) - throw new NullReferenceException(); - Contract.EndContractBlock(); - - return Activator.CreateInstanceFrom(assemblyFile, - typeName, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes); - } - internal ObjectHandle InternalCreateInstanceFromWithNoSecurity (string assemblyName, string typeName, bool ignoreCase, @@ -1372,205 +858,6 @@ namespace System #pragma warning restore 618 } - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public Assembly Load(AssemblyName assemblyRef) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public Assembly Load(String assemblyString) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, false); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public Assembly Load(byte[] rawAssembly) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.nLoadImage(rawAssembly, - null, // symbol store - null, // evidence - ref stackMark, - false, - SecurityContextSource.CurrentAssembly); - - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - public Assembly Load(byte[] rawAssembly, - byte[] rawSymbolStore) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.nLoadImage(rawAssembly, - rawSymbolStore, - null, // evidence - ref stackMark, - false, // fIntrospection - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")] - public Assembly Load(byte[] rawAssembly, - byte[] rawSymbolStore, - Evidence securityEvidence) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.nLoadImage(rawAssembly, - rawSymbolStore, - securityEvidence, - ref stackMark, - false, // fIntrospection - SecurityContextSource.CurrentAssembly); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public Assembly Load(AssemblyName assemblyRef, - Evidence assemblySecurity) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, assemblySecurity, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false); - } - - [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public Assembly Load(String assemblyString, - Evidence assemblySecurity) - { - StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; - return RuntimeAssembly.InternalLoad(assemblyString, assemblySecurity, ref stackMark, false); - } - - public int ExecuteAssembly(String assemblyFile) - { - return ExecuteAssembly(assemblyFile, (string[])null); - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssembly(String assemblyFile, - Evidence assemblySecurity) - { - return ExecuteAssembly(assemblyFile, assemblySecurity, null); - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssembly(String assemblyFile, - Evidence assemblySecurity, - String[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile, assemblySecurity); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - public int ExecuteAssembly(string assemblyFile, string[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssembly(String assemblyFile, - Evidence assemblySecurity, - String[] args, - byte[] hashValue, - AssemblyHashAlgorithm hashAlgorithm) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile, - assemblySecurity, - hashValue, - hashAlgorithm); - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - public int ExecuteAssembly(string assemblyFile, - string[] args, - byte[] hashValue, - AssemblyHashAlgorithm hashAlgorithm) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile, - hashValue, - hashAlgorithm); - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - public int ExecuteAssemblyByName(String assemblyName) - { - return ExecuteAssemblyByName(assemblyName, (string[])null); - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssemblyByName(String assemblyName, - Evidence assemblySecurity) - { -#pragma warning disable 618 - return ExecuteAssemblyByName(assemblyName, assemblySecurity, null); -#pragma warning restore 618 - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssemblyByName(String assemblyName, - Evidence assemblySecurity, - params String[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName, assemblySecurity); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - public int ExecuteAssemblyByName(string assemblyName, params string[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of ExecuteAssemblyByName which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public int ExecuteAssemblyByName(AssemblyName assemblyName, - Evidence assemblySecurity, - params String[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName, assemblySecurity); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - - public int ExecuteAssemblyByName(AssemblyName assemblyName, params string[] args) - { - RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName); - - if (args == null) - args = new String[0]; - - return nExecuteAssembly(assembly, args); - } - public static AppDomain CurrentDomain { get { @@ -1579,11 +866,6 @@ namespace System } } - public String FriendlyName - { - get { return nGetFriendlyName(); } - } - public String BaseDirectory { get { @@ -1616,19 +898,6 @@ namespace System return StringBuilderCache.GetStringAndRelease(sb); } - public Assembly[] GetAssemblies() - { - return nGetAssemblies(false /* forIntrospection */); - } - - public Assembly[] ReflectionOnlyGetAssemblies() - { - return nGetAssemblies(true /* forIntrospection */); - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern Assembly[] nGetAssemblies(bool forIntrospection); - // this is true when we've removed the handles etc so really can't do anything [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern bool IsUnloadingForcedFinalize(); @@ -1645,17 +914,6 @@ namespace System SetDataHelper(name, data, null); } - public void SetData (string name, object data, IPermission permission) - { - if (!name.Equals("LOCATION_URI")) - { - // Only LOCATION_URI can be set using AppDomain.SetData - throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyLocationURI", name)); - } - - SetDataHelper(name, data, permission); - } - private void SetDataHelper (string name, object data, IPermission permission) { if (name == null) @@ -1720,69 +978,15 @@ namespace System } } } - - // The compat flags are set at domain creation time to indicate that the given breaking - // change should not be used in this domain. - // - // After the domain has been created, this Nullable boolean returned by this method should - // always have a value. Code in the runtime uses this to know if it is safe to cache values - // that might change if the compatibility switches have not been set yet. - public Nullable IsCompatibilitySwitchSet(String value) - { - Nullable fReturn; - - if (_compatFlagsInitialized == false) - { - fReturn = new Nullable(); - } - else - { - fReturn = new Nullable(_compatFlags != null && _compatFlags.ContainsKey(value)); - } - - return fReturn; - } [Obsolete("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202", false)] [DllImport(Microsoft.Win32.Win32Native.KERNEL32)] public static extern int GetCurrentThreadId(); - internal ApplicationTrust ApplicationTrust - { - get { - if (_applicationTrust == null && _IsFastFullTrustDomain) { - _applicationTrust = new ApplicationTrust(new PermissionSet(PermissionState.Unrestricted)); - } - - return _applicationTrust; - } - } - - public String DynamicDirectory - { - get { - String dyndir = GetDynamicDir(); - if (dyndir != null) - new FileIOPermission( FileIOPermissionAccess.PathDiscovery, dyndir ).Demand(); - - return dyndir; - } - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private String GetDynamicDir(); - private AppDomain() { throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Constructor)); } - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern int _nExecuteAssembly(RuntimeAssembly assembly, String[] args); - internal int nExecuteAssembly(RuntimeAssembly assembly, String[] args) - { - return _nExecuteAssembly(assembly, args); - } - #if FEATURE_VERSIONING [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void nCreateContext(); @@ -1799,8 +1003,6 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern String nGetFriendlyName(); - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern bool nIsDefaultAppDomainForEvidence(); // support reliability for certain event handlers, if the target // methods also participate in this discipline. If caller passes @@ -2002,12 +1204,6 @@ namespace System } } - // Used to determine if server object context is valid in - // x-domain remoting scenarios. - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - internal static extern bool IsDomainIdValid(Int32 id); - [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] private static extern void nSetNativeDllSearchDirectories(string paths); @@ -2033,15 +1229,6 @@ namespace System _FusionStore = info; } - // used to package up evidence, so it can be serialized - // for the call to InternalRemotelySetupRemoteDomain - [Serializable] - private class EvidenceCollection - { - public Evidence ProvidedSecurityInfo; - public Evidence CreatorsSecurityInfo; - } - private static void RunInitializer(AppDomainSetup setup) { if (setup.AppDomainInitializer!=null) @@ -2312,22 +1499,6 @@ namespace System } } -#if FEATURE_LOADER_OPTIMIZATION - private void SetupLoaderOptimization(LoaderOptimization policy) - { - if(policy != LoaderOptimization.NotSpecified) { - Debug.Assert(FusionStore.LoaderOptimization == LoaderOptimization.NotSpecified, - "It is illegal to change the Loader optimization on a domain"); - - FusionStore.LoaderOptimization = policy; - UpdateLoaderOptimization(FusionStore.LoaderOptimization); - } - } -#endif - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal extern IntPtr GetSecurityDescriptor(); - private void SetupDomainSecurity(Evidence appDomainEvidence, IntPtr creatorsSecurityDescriptor, bool publishAppDomain) @@ -2377,25 +1548,6 @@ namespace System [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] private static extern void GetGrantSet(AppDomainHandle domain, ObjectHandleOnStack retGrantSet); - public PermissionSet PermissionSet - { - // SecurityCritical because permissions can contain sensitive information such as paths - get - { - PermissionSet grantSet = null; - GetGrantSet(GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref grantSet)); - - if (grantSet != null) - { - return grantSet.Copy(); - } - else - { - return new PermissionSet(PermissionState.Unrestricted); - } - } - } - public bool IsFullyTrusted { get @@ -2407,22 +1559,6 @@ namespace System } } - public bool IsHomogenous - { - get - { - // Homogenous AppDomains always have an ApplicationTrust associated with them - return _IsFastFullTrustDomain || _applicationTrust != null; - } - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void nChangeSecurityPolicy(); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - [ReliabilityContract(Consistency.MayCorruptAppDomain, Cer.MayFail)] - internal static extern void nUnload(Int32 domainInternal); - public Object CreateInstanceAndUnwrap(String assemblyName, String typeName) { @@ -2433,142 +1569,6 @@ namespace System return oh.Unwrap(); } // CreateInstanceAndUnwrap - public Object CreateInstanceAndUnwrap(String assemblyName, - String typeName, - Object[] activationAttributes) - { - ObjectHandle oh = CreateInstance(assemblyName, typeName, activationAttributes); - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - - - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceAndUnwrap which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public Object CreateInstanceAndUnwrap(String assemblyName, - String typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - Object[] args, - CultureInfo culture, - Object[] activationAttributes, - Evidence securityAttributes) - { -#pragma warning disable 618 - ObjectHandle oh = CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, - binder, args, culture, activationAttributes, securityAttributes); -#pragma warning restore 618 - - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - - public object CreateInstanceAndUnwrap(string assemblyName, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - ObjectHandle oh = CreateInstance(assemblyName, - typeName, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes); - - if (oh == null) - { - return null; - } - - return oh.Unwrap(); - } - - // The first parameter should be named assemblyFile, but it was incorrectly named in a previous - // release, and the compatibility police won't let us change the name now. - public Object CreateInstanceFromAndUnwrap(String assemblyName, - String typeName) - { - ObjectHandle oh = CreateInstanceFrom(assemblyName, typeName); - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - - - // The first parameter should be named assemblyFile, but it was incorrectly named in a previous - // release, and the compatibility police won't let us change the name now. - public Object CreateInstanceFromAndUnwrap(String assemblyName, - String typeName, - Object[] activationAttributes) - { - ObjectHandle oh = CreateInstanceFrom(assemblyName, typeName, activationAttributes); - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - - - // The first parameter should be named assemblyFile, but it was incorrectly named in a previous - // release, and the compatibility police won't let us change the name now. - [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceFromAndUnwrap which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")] - public Object CreateInstanceFromAndUnwrap(String assemblyName, - String typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - Object[] args, - CultureInfo culture, - Object[] activationAttributes, - Evidence securityAttributes) - { -#pragma warning disable 618 - ObjectHandle oh = CreateInstanceFrom(assemblyName, typeName, ignoreCase, bindingAttr, - binder, args, culture, activationAttributes, securityAttributes); -#pragma warning restore 618 - - if (oh == null) - return null; - - return oh.Unwrap(); - } // CreateInstanceAndUnwrap - - public object CreateInstanceFromAndUnwrap(string assemblyFile, - string typeName, - bool ignoreCase, - BindingFlags bindingAttr, - Binder binder, - object[] args, - CultureInfo culture, - object[] activationAttributes) - { - ObjectHandle oh = CreateInstanceFrom(assemblyFile, - typeName, - ignoreCase, - bindingAttr, - binder, - args, - culture, - activationAttributes); - if (oh == null) - { - return null; - } - - return oh.Unwrap(); - } - public Int32 Id { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -2580,15 +1580,6 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal extern Int32 GetId(); - - internal const Int32 DefaultADID = 1; - - public bool IsDefaultAppDomain() - { - if (GetId()==DefaultADID) - return true; - return false; - } #if FEATURE_APPDOMAIN_RESOURCE_MONITORING [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/src/mscorlib/src/System/AppDomainSetup.cs b/src/mscorlib/src/System/AppDomainSetup.cs index fc8a64c192..f3e6f79663 100644 --- a/src/mscorlib/src/System/AppDomainSetup.cs +++ b/src/mscorlib/src/System/AppDomainSetup.cs @@ -28,8 +28,7 @@ namespace System [Serializable] [ClassInterface(ClassInterfaceType.None)] [System.Runtime.InteropServices.ComVisible(true)] - public sealed class AppDomainSetup : - IAppDomainSetup + public sealed class AppDomainSetup { [Serializable] internal enum LoaderInformation @@ -439,22 +438,6 @@ namespace System return path; } - private bool IsFilePath(String path) - { -#if !PLATFORM_UNIX - return (path[1] == ':') || ( (path[0] == '\\') && (path[1] == '\\') ); -#else - return (path[0] == '/'); -#endif // !PLATFORM_UNIX - } - - internal static String ApplicationBaseKey - { - get { - return ACTAG_APP_BASE_URL; - } - } - public String ConfigurationFile { get { @@ -466,22 +449,6 @@ namespace System } } - // Used by the ResourceManager internally. This must not do any - // security checks to avoid infinite loops. - internal String ConfigurationFileInternal - { - get { - return NormalizePath(Value[(int) LoaderInformation.ConfigurationFileValue], true); - } - } - - internal static String ConfigurationFileKey - { - get { - return ACTAG_APP_CONFIG_FILE; - } - } - public byte[] GetConfigurationBytes() { if (_ConfigurationBytes == null) @@ -490,18 +457,6 @@ namespace System return (byte[]) _ConfigurationBytes.Clone(); } - public void SetConfigurationBytes(byte[] value) - { - _ConfigurationBytes = value; - } - - private static String ConfigurationBytesKey - { - get { - return ACTAG_APP_CONFIG_BLOB; - } - } - // only needed by AppDomain.Setup(). Not really needed by users. internal Dictionary GetCompatibilityFlags() { @@ -543,105 +498,6 @@ namespace System } } - internal bool CheckedForTargetFrameworkName - { - get { return _CheckedForTargetFrameworkName; } - set { _CheckedForTargetFrameworkName = value; } - } - - public String DynamicBase - { - get { - return VerifyDir(Value[(int) LoaderInformation.DynamicBaseValue], true); - } - - set { - if (value == null) - Value[(int) LoaderInformation.DynamicBaseValue] = null; - else { - if(ApplicationName == null) - throw new MemberAccessException(Environment.GetResourceString("AppDomain_RequireApplicationName")); - - StringBuilder s = new StringBuilder( NormalizePath(value, false) ); - s.Append('\\'); - string h = ParseNumbers.IntToString(ApplicationName.GetLegacyNonRandomizedHashCode(), - 16, 8, '0', ParseNumbers.PrintAsI4); - s.Append(h); - - Value[(int) LoaderInformation.DynamicBaseValue] = s.ToString(); - } - } - } - - internal static String DynamicBaseKey - { - get { - return ACTAG_APP_DYNAMIC_BASE; - } - } - - public bool DisallowPublisherPolicy - { - get - { - return (Value[(int) LoaderInformation.DisallowPublisherPolicyValue] != null); - } - set - { - if (value) - Value[(int) LoaderInformation.DisallowPublisherPolicyValue]="true"; - else - Value[(int) LoaderInformation.DisallowPublisherPolicyValue]=null; - } - } - - - public bool DisallowBindingRedirects - { - get - { - return (Value[(int) LoaderInformation.DisallowBindingRedirectsValue] != null); - } - set - { - if (value) - Value[(int) LoaderInformation.DisallowBindingRedirectsValue] = "true"; - else - Value[(int) LoaderInformation.DisallowBindingRedirectsValue] = null; - } - } - - public bool DisallowCodeDownload - { - get - { - return (Value[(int) LoaderInformation.DisallowCodeDownloadValue] != null); - } - set - { - if (value) - Value[(int) LoaderInformation.DisallowCodeDownloadValue] = "true"; - else - Value[(int) LoaderInformation.DisallowCodeDownloadValue] = null; - } - } - - - public bool DisallowApplicationBaseProbing - { - get - { - return (Value[(int) LoaderInformation.DisallowAppBaseProbingValue] != null); - } - set - { - if (value) - Value[(int) LoaderInformation.DisallowAppBaseProbingValue] = "true"; - else - Value[(int) LoaderInformation.DisallowAppBaseProbingValue] = null; - } - } - private String VerifyDir(String dir, bool normalize) { if (dir != null) { @@ -656,93 +512,6 @@ namespace System return dir; } - private void VerifyDirList(String dirs) - { - if (dirs != null) { - String[] dirArray = dirs.Split(';'); - int len = dirArray.Length; - - for (int i = 0; i < len; i++) - VerifyDir(dirArray[i], true); - } - } - - internal String DeveloperPath - { - get { - String dirs = Value[(int) LoaderInformation.DevPathValue]; - VerifyDirList(dirs); - return dirs; - } - - set { - if(value == null) - Value[(int) LoaderInformation.DevPathValue] = null; - else { - String[] directories = value.Split(';'); - int size = directories.Length; - StringBuilder newPath = StringBuilderCache.Acquire(); - bool fDelimiter = false; - - for(int i = 0; i < size; i++) { - if(directories[i].Length != 0) { - if(fDelimiter) - newPath.Append(";"); - else - fDelimiter = true; - - newPath.Append(Path.GetFullPath(directories[i])); - } - } - - String newString = StringBuilderCache.GetStringAndRelease(newPath); - if (newString.Length == 0) - Value[(int) LoaderInformation.DevPathValue] = null; - else - Value[(int) LoaderInformation.DevPathValue] = newString; - } - } - } - - internal static String DisallowPublisherPolicyKey - { - get - { - return ACTAG_DISALLOW_APPLYPUBLISHERPOLICY; - } - } - - internal static String DisallowCodeDownloadKey - { - get - { - return ACTAG_CODE_DOWNLOAD_DISABLED; - } - } - - internal static String DisallowBindingRedirectsKey - { - get - { - return ACTAG_DISALLOW_APP_BINDING_REDIRECTS; - } - } - - internal static String DeveloperPathKey - { - get { - return ACTAG_DEV_PATH; - } - } - - internal static String DisallowAppBaseProbingKey - { - get - { - return ACTAG_DISALLOW_APP_BASE_PROBING; - } - } - public String ApplicationName { get { @@ -754,13 +523,6 @@ namespace System } } - internal static String ApplicationNameKey - { - get { - return ACTAG_APP_NAME; - } - } - [XmlIgnoreMember] public AppDomainInitializer AppDomainInitializer { @@ -804,115 +566,6 @@ namespace System } } - public String PrivateBinPath - { - get { - String dirs = Value[(int) LoaderInformation.PrivateBinPathValue]; - VerifyDirList(dirs); - return dirs; - } - - set { - Value[(int) LoaderInformation.PrivateBinPathValue] = value; - } - } - - internal static String PrivateBinPathKey - { - get { - return ACTAG_APP_PRIVATE_BINPATH; - } - } - - public String PrivateBinPathProbe - { - get { - return Value[(int) LoaderInformation.PrivateBinPathProbeValue]; - } - - set { - Value[(int) LoaderInformation.PrivateBinPathProbeValue] = value; - } - } - - internal static String PrivateBinPathProbeKey - { - get { - return ACTAG_BINPATH_PROBE_ONLY; - } - } - - public String ShadowCopyDirectories - { - get { - String dirs = Value[(int) LoaderInformation.ShadowCopyDirectoriesValue]; - VerifyDirList(dirs); - return dirs; - } - - set { - Value[(int) LoaderInformation.ShadowCopyDirectoriesValue] = value; - } - } - - internal static String ShadowCopyDirectoriesKey - { - get { - return ACTAG_APP_SHADOW_COPY_DIRS; - } - } - - public String ShadowCopyFiles - { - get { - return Value[(int) LoaderInformation.ShadowCopyFilesValue]; - } - - set { - if((value != null) && - (String.Compare(value, "true", StringComparison.OrdinalIgnoreCase) == 0)) - Value[(int) LoaderInformation.ShadowCopyFilesValue] = value; - else - Value[(int) LoaderInformation.ShadowCopyFilesValue] = null; - } - } - - internal static String ShadowCopyFilesKey - { - get { - return ACTAG_FORCE_CACHE_INSTALL; - } - } - - public String CachePath - { - get { - return VerifyDir(Value[(int) LoaderInformation.CachePathValue], false); - } - - set { - Value[(int) LoaderInformation.CachePathValue] = NormalizePath(value, false); - } - } - - internal static String CachePathKey - { - get { - return ACTAG_APP_CACHE_BASE; - } - } - - public String LicenseFile - { - get { - return VerifyDir(Value[(int) LoaderInformation.LicenseFileValue], true); - } - - set { - Value[(int) LoaderInformation.LicenseFileValue] = value; - } - } - public LoaderOptimization LoaderOptimization { get { @@ -938,34 +591,6 @@ namespace System } } - internal static String PrivateBinPathEnvironmentVariable - { - get { - return APPENV_RELATIVEPATH; - } - } - - internal static string RuntimeConfigurationFile - { - get { - return MACHINE_CONFIGURATION_FILE; - } - } - - internal static string MachineConfigKey - { - get { - return ACTAG_MACHINE_CONFIG; - } - } - - internal static string HostBindingKey - { - get { - return ACTAG_HOST_CONFIG_FILE; - } - } - static internal int Locate(String s) { if(String.IsNullOrEmpty(s)) diff --git a/src/mscorlib/src/System/CompatibilitySwitches.cs b/src/mscorlib/src/System/CompatibilitySwitches.cs index bb2f02a679..d699917feb 100644 --- a/src/mscorlib/src/System/CompatibilitySwitches.cs +++ b/src/mscorlib/src/System/CompatibilitySwitches.cs @@ -20,39 +20,9 @@ namespace System } } - private static bool IsCompatibilitySwitchSet(string compatibilitySwitch) - { - bool? result = AppDomain.CurrentDomain.IsCompatibilitySwitchSet(compatibilitySwitch); - return (result.HasValue && result.Value); - } - internal static void InitializeSwitches() { s_AreSwitchesSet = true; } - - public static bool IsNetFx40TimeSpanLegacyFormatMode - { - get - { - return false; - } - } - - public static bool IsNetFx40LegacySecurityPolicy - { - get - { - return false; - } - } - - public static bool IsNetFx45LegacyManagedDeflateStream - { - get - { - return false; - } - } } } diff --git a/src/mscorlib/src/System/IAppDomainSetup.cs b/src/mscorlib/src/System/IAppDomainSetup.cs deleted file mode 100644 index a088c629d8..0000000000 --- a/src/mscorlib/src/System/IAppDomainSetup.cs +++ /dev/null @@ -1,84 +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. - -/*============================================================ -** -** Interface: IAppDomainSetup -** -** -** -** -** Purpose: Properties exposed to COM -** -** -===========================================================*/ -namespace System { - - using System.Runtime.InteropServices; - - [GuidAttribute("27FFF232-A7A8-40dd-8D4A-734AD59FCD41")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] -[System.Runtime.InteropServices.ComVisible(true)] - public interface IAppDomainSetup - { - String ApplicationBase { - get; - set; - } - - String ApplicationName - { - get; - set; - } - - String CachePath - { - get; - set; - } - - String ConfigurationFile { - get; - set; - } - - String DynamicBase - { - get; - set; - } - - String LicenseFile - { - get; - set; - } - - String PrivateBinPath - { - get; - set; - } - - String PrivateBinPathProbe - { - get; - set; - } - - String ShadowCopyDirectories - { - get; - set; - } - - String ShadowCopyFiles - { - get; - set; - } - - } -} diff --git a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs index e080134f2a..1539c17530 100644 --- a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -1142,47 +1142,6 @@ namespace System.Reflection.Emit parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); } - public MethodBuilder DefinePInvokeMethod(String name, String dllName, MethodAttributes attributes, - CallingConventions callingConvention, Type returnType, Type[] parameterTypes, - CallingConvention nativeCallConv, CharSet nativeCharSet) - { - Contract.Ensures(Contract.Result() != null); - - return DefinePInvokeMethod(name, dllName, name, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); - } - - public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, - CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, - CharSet nativeCharSet) - { - Contract.Ensures(Contract.Result() != null); - - lock(SyncRoot) - { - return DefinePInvokeMethodNoLock(name, dllName, entryName, attributes, callingConvention, - returnType, parameterTypes, nativeCallConv, nativeCharSet); - } - } - - private MethodBuilder DefinePInvokeMethodNoLock(String name, String dllName, String entryName, MethodAttributes attributes, - CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, - CharSet nativeCharSet) - { - //Global methods must be static. - if ((attributes & MethodAttributes.Static) == 0) - { - throw new ArgumentException(Environment.GetResourceString("Argument_GlobalFunctionHasToBeStatic")); - } - Contract.Ensures(Contract.Result() != null); - Contract.EndContractBlock(); - - CheckContext(returnType); - CheckContext(parameterTypes); - - m_moduleData.m_fHasGlobal = true; - return m_moduleData.m_globalTypeBuilder.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); - } - public void CreateGlobalFunctions() { lock(SyncRoot) diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs index 73778d5f27..36809009a3 100644 --- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs @@ -659,28 +659,6 @@ namespace System.Reflection.Emit { #endregion #region Private Members - private MethodBuilder DefinePInvokeMethodHelper( - String name, String dllName, String importName, MethodAttributes attributes, CallingConventions callingConvention, - Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, - Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, - CallingConvention nativeCallConv, CharSet nativeCharSet) - { - CheckContext(returnType); - CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes); - CheckContext(parameterTypeRequiredCustomModifiers); - CheckContext(parameterTypeOptionalCustomModifiers); - - AppDomain.CheckDefinePInvokeSupported(); - - lock (SyncRoot) - { - return DefinePInvokeMethodHelperNoLock(name, dllName, importName, attributes, callingConvention, - returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, - parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, - nativeCallConv, nativeCharSet); - } - } - private MethodBuilder DefinePInvokeMethodHelperNoLock( String name, String dllName, String importName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, @@ -1786,41 +1764,6 @@ namespace System.Reflection.Emit { #endregion - #region Define PInvoke - public MethodBuilder DefinePInvokeMethod(String name, String dllName, MethodAttributes attributes, - CallingConventions callingConvention, Type returnType, Type[] parameterTypes, - CallingConvention nativeCallConv, CharSet nativeCharSet) - { - MethodBuilder method = DefinePInvokeMethodHelper( - name, dllName, name, attributes, callingConvention, returnType, null, null, - parameterTypes, null, null, nativeCallConv, nativeCharSet); - return method; - } - - public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, - CallingConventions callingConvention, Type returnType, Type[] parameterTypes, - CallingConvention nativeCallConv, CharSet nativeCharSet) - { - MethodBuilder method = DefinePInvokeMethodHelper( - name, dllName, entryName, attributes, callingConvention, returnType, null, null, - parameterTypes, null, null, nativeCallConv, nativeCharSet); - return method; - } - - public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, - CallingConventions callingConvention, - Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, - Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, - CallingConvention nativeCallConv, CharSet nativeCharSet) - { - MethodBuilder method = DefinePInvokeMethodHelper( - name, dllName, entryName, attributes, callingConvention, returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, - parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, nativeCallConv, nativeCharSet); - return method; - } - - #endregion - #region Define Nested Type public TypeBuilder DefineNestedType(String name) { diff --git a/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs index a5c058da43..15aaf14afe 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs @@ -58,21 +58,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String GetRuntimeDirectoryImpl(); - // Returns the system ConfigurationFile - public static String SystemConfigurationFile { - get { - StringBuilder sb = new StringBuilder(Path.MaxPath); - sb.Append(GetRuntimeDirectory()); - sb.Append(AppDomainSetup.RuntimeConfigurationFile); - String path = sb.ToString(); - - // Do security check - new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand(); - - return path; - } - } - #if FEATURE_COMINTEROP [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs index d575201bb9..9f822d5ced 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs @@ -123,7 +123,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // We can safely skip access check because this is only used in full trust scenarios. // And we have already verified that the property accessor is public. - Debug.Assert(AppDomain.CurrentDomain.PermissionSet.IsUnrestricted()); return rtMethod.UnsafeInvoke(target, BindingFlags.Default, null, args, null); } -- 2.34.1