summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/AppDomain.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/AppDomain.cs')
-rw-r--r--src/mscorlib/src/System/AppDomain.cs178
1 files changed, 14 insertions, 164 deletions
diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs
index 7d2f2ceaf8..24c6765026 100644
--- a/src/mscorlib/src/System/AppDomain.cs
+++ b/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;
@@ -37,7 +36,6 @@ namespace System
using System.Diagnostics.Contracts;
using System.Runtime.ExceptionServices;
- [Serializable]
internal delegate void AppDomainInitializer(string[] args);
internal class AppDomainInitializerInfo
@@ -258,18 +256,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 +314,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 +423,6 @@ namespace System
}
/// <summary>
- /// Get the name of the assembly and type that act as the AppDomainManager for this domain
- /// </summary>
- 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;
- }
-
- /// <summary>
- /// Set the assembly and type which act as the AppDomainManager for this domain
- /// </summary>
- private void SetAppDomainManagerType(string assembly, string type)
- {
- Debug.Assert(assembly != null, "assembly != null");
- Debug.Assert(type != null, "type != null");
- SetAppDomainManagerType(GetNativeHandle(), assembly, type);
- }
-
- /// <summary>
/// Called for every AppDomain (including the default domain) to initialize the security of the AppDomain)
/// </summary>
private void InitializeDomainSecurity(Evidence providedSecurityInfo,
@@ -584,23 +494,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
@@ -646,6 +539,14 @@ namespace System
return StringBuilderCache.GetStringAndRelease(sb);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern Assembly[] nGetAssemblies(bool forIntrospection);
+
+ internal Assembly[] GetAssemblies(bool forIntrospection)
+ {
+ return nGetAssemblies(forIntrospection);
+ }
+
// this is true when we've removed the handles etc so really can't do anything
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern bool IsUnloadingForcedFinalize();
@@ -664,17 +565,6 @@ namespace System
throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
- // SetData should only be used to set values that don't already exist.
- object currentVal;
- lock (((ICollection)LocalStore).SyncRoot)
- {
- LocalStore.TryGetValue(name, out currentVal);
- }
- if (currentVal != null)
- {
- throw new InvalidOperationException(SR.InvalidOperation_SetData_OnlyOnce);
- }
-
lock (((ICollection)LocalStore).SyncRoot)
{
LocalStore[name] = data;
@@ -688,38 +578,14 @@ namespace System
throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
- int key = AppDomainSetup.Locate(name);
- if (key == -1)
+ object data;
+ lock (((ICollection)LocalStore).SyncRoot)
{
- if (name.Equals(AppDomainSetup.LoaderOptimizationKey))
- return FusionStore.LoaderOptimization;
- else
- {
- object data;
- lock (((ICollection)LocalStore).SyncRoot)
- {
- LocalStore.TryGetValue(name, out data);
- }
- if (data == null)
- return null;
- return data;
- }
- }
- else
- {
- // Be sure to call these properties, not Value, so
- // that the appropriate permission demand will be done
- switch (key)
- {
- case (int)AppDomainSetup.LoaderInformation.ApplicationBaseValue:
- return FusionStore.ApplicationBase;
- case (int)AppDomainSetup.LoaderInformation.ApplicationNameValue:
- return FusionStore.ApplicationName;
- default:
- Debug.Assert(false, "Need to handle new LoaderInformation value in AppDomain.GetData()");
- return null;
- }
+ LocalStore.TryGetValue(name, out data);
}
+ if (data == null)
+ return null;
+ return data;
}
[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)]
@@ -1150,12 +1016,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,
@@ -1293,16 +1153,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