AssemblyLoadContextTracker

Ecng.Compilation

Provides tracking functionality for AssemblyLoadContext instances when loading assemblies dynamically. Implements ICompilerContext and manages unloading of previous contexts when loading a new assembly.

继承自: Disposable

实现: ICompilerContext, IDisposable

构造函数

AssemblyLoadContextTracker
public AssemblyLoadContextTracker(Action<Exception> uploadingError)
assemblyLoadContextTracker = AssemblyLoadContextTracker(uploadingError)

Provides tracking functionality for AssemblyLoadContext instances when loading assemblies dynamically. Implements ICompilerContext and manages unloading of previous contexts when loading a new assembly.

方法

DisposeManaged
protected override void DisposeManaged()
assemblyLoadContextTracker.DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

LoadFromBinary
public Assembly LoadFromBinary(byte[] assembly)
result = assemblyLoadContextTracker.LoadFromBinary(assembly)

Loads an assembly from the provided binary data. If a different assembly is passed than the one previously loaded, the previous context is unloaded.

assembly
The binary representation of the assembly to load.

返回值: The loaded Assembly instance.

Unload
public void Unload()
assemblyLoadContextTracker.Unload()

Unloads the current AssemblyLoadContext and resets the internal state.