Class ModuleAssemblyLoadContext
Isolated for module isolation.
Each dynamically loaded module gets its own ALC.
When collectible, the ALC can be unloaded and replaced without restarting the process.
When non-collectible (default), a replaced ALC stays in memory until the process restarts.
Loads from bytes so the original DLL file is never locked.
Probes configured directories for dependencies so modules don't need
to be in the host application's bin folder.
public sealed class ModuleAssemblyLoadContext : AssemblyLoadContext
Inheritance
Methods
Load(AssemblyName)
When overridden in a derived class, allows an assembly to be resolved based on its .
protected override Assembly? Load(AssemblyName assemblyName)
LoadFromBytes(string)
Reads dllPath into memory and loads from stream — file is never locked.
public Assembly LoadFromBytes(string dllPath)
LoadUnmanagedDll(string)
Allows derived class to load an unmanaged library by name.
protected override nint LoadUnmanagedDll(string unmanagedDllName)
TryUnload()
Lets the context go: unloads it if collectible. A context that is not collectible stays in memory until the process
public void TryUnload()