Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AssemblyLoadContext.cs « Loader « Runtime « System « src « System.Private.CoreLib « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 161de82aed8f18defdbabc71df42f908b4f85fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 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.

using System.Reflection;
using Internal.Reflection.Augments;

// This type is just stubbed out to be harmonious with CoreCLR
namespace System.Runtime.Loader
{
    public abstract class AssemblyLoadContext
    {
        public static Assembly[] GetLoadedAssemblies() => ReflectionAugments.ReflectionCoreCallbacks.GetLoadedAssemblies(); 

        // These events are never called
#pragma warning disable 0067
        public static event AssemblyLoadEventHandler AssemblyLoad;
        public static event ResolveEventHandler TypeResolve;
        public static event ResolveEventHandler ResourceResolve;
        public static event ResolveEventHandler AssemblyResolve;

        public event Func<AssemblyLoadContext, AssemblyName, Assembly> Resolving;
        public event Action<AssemblyLoadContext> Unloading;
#pragma warning restore 0067

        public static AssemblyLoadContext Default { get; } = new DefaultAssemblyLoadContext();

        public static AssemblyLoadContext GetLoadContext(Assembly assembly)
        {
            return Default;
        }

        public Assembly LoadFromAssemblyPath(string assemblyPath)
        {
            throw new PlatformNotSupportedException();
        }

        public void SetProfileOptimizationRoot(string directoryPath) { }
        public void StartProfileOptimization(string profile) { }
    }

    /// <summary>
    /// AssemblyLoadContext is not supported in .NET Native. This is
    /// just a dummy class to make applications compile.
    /// </summary>
    internal class DefaultAssemblyLoadContext : AssemblyLoadContext
    {
    }
}