From: Rahul Kumar Date: Thu, 27 Oct 2016 01:14:39 +0000 (-0700) Subject: expose events from AppDomain via AssemblyLoadContext X-Git-Tag: submit/tizen/20210909.063632~11030^2~9063^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a5d43d293c4c90363a512a647163f357026a3a6;p=platform%2Fupstream%2Fdotnet%2Fruntime.git expose events from AppDomain via AssemblyLoadContext Commit migrated from https://github.com/dotnet/coreclr/commit/35aedcbaa560481d729f3582fb9d42804a43e359 --- diff --git a/src/coreclr/src/mscorlib/model.xml b/src/coreclr/src/mscorlib/model.xml index 130702e..30563da5 100644 --- a/src/coreclr/src/mscorlib/model.xml +++ b/src/coreclr/src/mscorlib/model.xml @@ -1084,7 +1084,10 @@ + + + diff --git a/src/coreclr/src/mscorlib/ref/mscorlib.cs b/src/coreclr/src/mscorlib/ref/mscorlib.cs index 27b0d30..f84ee4b 100644 --- a/src/coreclr/src/mscorlib/ref/mscorlib.cs +++ b/src/coreclr/src/mscorlib/ref/mscorlib.cs @@ -11966,6 +11966,9 @@ namespace System.Runtime.Loader public static System.Runtime.Loader.AssemblyLoadContext Default { get { throw null; } } public event System.Func Resolving { add { } remove { } } public event System.Action Unloading { add { } remove { } } + public static event AssemblyLoadEventHandler AssemblyLoad { add { } remove { } } + public static event ResolveEventHandler TypeResolve { add { } remove { } } + public static event ResolveEventHandler ResourceResolve { add { } remove { } } public static System.Reflection.AssemblyName GetAssemblyName(string assemblyPath) { throw null; } public static System.Runtime.Loader.AssemblyLoadContext GetLoadContext(System.Reflection.Assembly assembly) { throw null; } public static System.Reflection.Assembly[] GetLoadedAssemblies() { throw null; } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs index ab8f4e8..2c07325 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs @@ -470,6 +470,27 @@ namespace System.Runtime.Loader // Synchronization primitive for controlling initialization of Default load context private static readonly object s_initLock = new Object(); + + // Occurs when an Assembly is loaded + public static event AssemblyLoadEventHandler AssemblyLoad + { + add { AppDomain.CurrentDomain.AssemblyLoad += value; } + remove { AppDomain.CurrentDomain.AssemblyLoad -= value; } + } + + // Occurs when resolution of type fails + public static event ResolveEventHandler TypeResolve + { + add { AppDomain.CurrentDomain.TypeResolve += value; } + remove { AppDomain.CurrentDomain.TypeResolve -= value; } + } + + // Occurs when resolution of resource fails + public static event ResolveEventHandler ResourceResolve + { + add { AppDomain.CurrentDomain.ResourceResolve += value; } + remove { AppDomain.CurrentDomain.ResourceResolve -= value; } + } } [System.Security.SecuritySafeCritical]