From a8bd1c919751806eb9bfe0960abae3e496c19ae4 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 16 Dec 2015 19:16:31 +0100 Subject: [PATCH] Add feature define for multiple appdomains. --- .../Runtime/Diagnostics/DiagnosticTraceBase.cs | 2 ++ .../referencesource/mscorlib/system/activator.cs | 12 ++++++++++++ .../system/threading/Tasks/TaskExceptionHolder.cs | 2 ++ 3 files changed, 16 insertions(+) diff --git a/mcs/class/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceBase.cs b/mcs/class/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceBase.cs index 5089c872773..f3ab701ee2f 100644 --- a/mcs/class/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceBase.cs +++ b/mcs/class/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceBase.cs @@ -309,7 +309,9 @@ namespace System.Runtime.Diagnostics { currentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler); this.SetLevel(this.TraceSource.Switch.Level); +#if MONO_FEATURE_MULTIPLE_APPDOMAINS currentDomain.DomainUnload += new EventHandler(ExitOrUnloadEventHandler); +#endif currentDomain.ProcessExit += new EventHandler(ExitOrUnloadEventHandler); } } diff --git a/mcs/class/referencesource/mscorlib/system/activator.cs b/mcs/class/referencesource/mscorlib/system/activator.cs index 758e9681363..0a1ffa93eb5 100644 --- a/mcs/class/referencesource/mscorlib/system/activator.cs +++ b/mcs/class/referencesource/mscorlib/system/activator.cs @@ -611,6 +611,7 @@ namespace System { #if FEATURE_COMINTEROP || MONO_COM || MOBILE_LEGACY #if FEATURE_CLICKONCE || MOBILE_LEGACY +#if FEATURE_CLICKONCE || MONO_FEATURE_MULTIPLE_APPDOMAINS [System.Security.SecuritySafeCritical] // auto-generated public static ObjectHandle CreateInstance (ActivationContext activationContext) { AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager; @@ -628,6 +629,17 @@ namespace System { return domainManager.ApplicationActivator.CreateInstance(activationContext, activationCustomData); } +#else + [Obsolete ("Activator.CreateInstance (ActivationContext) is not supported on this platform.", true)] + public static ObjectHandle CreateInstance (ActivationContext activationContext) { + throw new PlatformNotSupportedException ("Activator.CreateInstance (ActivationContext) is not supported on this platform."); + } + + [Obsolete ("Activator.CreateInstance (ActivationContext, string[]) is not supported on this platform.", true)] + public static ObjectHandle CreateInstance (ActivationContext activationContext, string[] activationCustomData) { + throw new PlatformNotSupportedException ("Activator.CreateInstance (ActivationContext) is not supported on this platform."); + } +#endif #endif // FEATURE_CLICKONCE [ResourceExposure(ResourceScope.Machine)] diff --git a/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs b/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs index 32d121d166c..8be36b654ba 100644 --- a/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs +++ b/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs @@ -77,6 +77,7 @@ namespace System.Threading.Tasks private static void EnsureADUnloadCallbackRegistered() { +#if MONO_FEATURE_MULTIPLE_APPDOMAINS if (s_adUnloadEventHandler == null && Interlocked.CompareExchange( ref s_adUnloadEventHandler, AppDomainUnloadCallback, @@ -84,6 +85,7 @@ namespace System.Threading.Tasks { AppDomain.CurrentDomain.DomainUnload += s_adUnloadEventHandler; } +#endif } private static void AppDomainUnloadCallback(object sender, EventArgs e) -- 2.25.1