SharpClaw.Modules.Hosting
0.1.3-alpha
dotnet add package SharpClaw.Modules.Hosting --version 0.1.3-alpha
NuGet\Install-Package SharpClaw.Modules.Hosting -Version 0.1.3-alpha
<PackageReference Include="SharpClaw.Modules.Hosting" Version="0.1.3-alpha" />
<PackageVersion Include="SharpClaw.Modules.Hosting" Version="0.1.3-alpha" />
<PackageReference Include="SharpClaw.Modules.Hosting" />
paket add SharpClaw.Modules.Hosting --version 0.1.3-alpha
#r "nuget: SharpClaw.Modules.Hosting, 0.1.3-alpha"
#:package SharpClaw.Modules.Hosting@0.1.3-alpha
#addin nuget:?package=SharpClaw.Modules.Hosting&version=0.1.3-alpha&prerelease
#tool nuget:?package=SharpClaw.Modules.Hosting&version=0.1.3-alpha&prerelease
SharpClaw.Modules.Hosting
SharpClaw.Modules.Hosting is for host and runtime code that loads compiled
SharpClaw .NET module assemblies. Its ModuleLoadContext creates a collectible
assembly load context for one module entry DLL, resolves that module's private
dependencies from the module folder, and keeps host-owned contract assemblies
in the default load context so module objects can still be cast to the host's
SharpClaw contract interfaces.
Reference this package when you are writing a SharpClaw host, gateway, test
harness, or runtime adapter that needs to load a module DLL from disk. A normal
module implementation usually references SharpClaw.Contracts for
ISharpClawCoreModule and related DTOs; it only needs this package when it is
itself responsible for loading another module assembly.
The smallest host-side shape is to create one load context for the module entry assembly, load the assembly through that context, and then find the module type using the shared contract interfaces already loaded by the host.
using System.Reflection;
using SharpClaw.Contracts.Modules;
using SharpClaw.Modules.Hosting;
var entryAssemblyPath = Path.Combine(moduleDirectory, "MyModule.dll");
var loadContext = new ModuleLoadContext(entryAssemblyPath);
var assembly = loadContext.LoadFromAssemblyPath(Path.GetFullPath(entryAssemblyPath));
var moduleType = assembly.GetTypes()
.Single(type => type.IsAssignableTo(typeof(ISharpClawCoreModule)) && !type.IsAbstract);
Use a separate ModuleLoadContext for each loaded module instance. When the
module is unloaded, release references to objects and types from that assembly
before calling Unload; the runtime can only collect the context after those
references are gone.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharpClaw.Modules.Hosting:
| Package | Downloads |
|---|---|
|
SharpClaw.Modules.DotNetSidecarHost
Runs compiled SharpClaw .NET modules as sidecar processes over the SharpClaw foreign-module protocol. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.3-alpha | 61 | 7/5/2026 |
| 0.1.2-alpha | 44 | 7/5/2026 |
| 0.1.1-alpha | 49 | 7/5/2026 |
| 0.1.0-alpha | 61 | 7/4/2026 |