Class CadPluginLoader
Loads the assemblies of a plugin for CadPluginManager, and unloads them, as the runtime allows: on .NET 8
each plugin into a collectible load context of its own, which unloading frees; on .NET Framework into the one
AppDomain, from which nothing is ever unloaded. The presenter's controls give the loader of the runtime they run on
(OpenCAD2D.Wpf.Plugins.CadPluginAssemblyLoader); this library, built for netstandard2.0, has
no load contexts to give one of its own.
public abstract class CadPluginLoader
- Inheritance
-
CadPluginLoader
- Inherited Members
Properties
- CanCompile
Gets whether Compile(string, string) builds plugins given as C# source: true in the app on .NET 8, false here and on .NET Framework.
- CanUnload
Gets whether Unload(IReadOnlyList<Assembly>) frees a plugin's code, so that a new build of it can be loaded while the presenter runs.
Methods
- Compile(string, string)
Compiles a plugin given as a folder with a .csproj into an assembly and its PDB, or takes them from the cache where the project and its sources are unchanged since they were last compiled. This loader cannot (CanCompile is false).
- Load(string, IReadOnlyList<string>, string)
Loads a plugin's assemblies from the copies of its files the manager made (its shadow copy). An assembly the presenter has itself, as OpenCAD2D, is not loaded a second time: the plugin is given the presenter's.
- Unload(IReadOnlyList<Assembly>)
Unloads the assemblies Load(string, IReadOnlyList<string>, string) gave, where CanUnload says it can; does nothing where it cannot.