SharpClaw.ModuleHost.InProcess 0.1.0-alpha

This is a prerelease version of SharpClaw.ModuleHost.InProcess.
dotnet add package SharpClaw.ModuleHost.InProcess --version 0.1.0-alpha
                    
NuGet\Install-Package SharpClaw.ModuleHost.InProcess -Version 0.1.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpClaw.ModuleHost.InProcess" Version="0.1.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpClaw.ModuleHost.InProcess" Version="0.1.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="SharpClaw.ModuleHost.InProcess" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpClaw.ModuleHost.InProcess --version 0.1.0-alpha
                    
#r "nuget: SharpClaw.ModuleHost.InProcess, 0.1.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpClaw.ModuleHost.InProcess@0.1.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpClaw.ModuleHost.InProcess&version=0.1.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SharpClaw.ModuleHost.InProcess&version=0.1.0-alpha&prerelease
                    
Install as a Cake Tool

SharpClaw.ModuleHost.InProcess

SharpClaw.ModuleHost.InProcess supports the opt-in in-process .NET module host path for SharpClaw. It provides ModuleLoadContext, a collectible assembly load context that loads a module entry DLL from its module directory while delegating host-owned contracts back to the default load context. That keeps interfaces such as ISharpClawCoreModule shared between the host and the loaded module instead of accidentally loading a second copy of the contract assembly.

Out-of-process hosting is the normal SharpClaw module execution model. In-process hosting is a limited mode for hosts that deliberately enable it and can accept its tighter coupling to the host process. Reference this package when you are writing SharpClaw runtime code, a test harness, or an explicitly in-process host adapter that needs to load a module DLL directly.

The smallest in-process host shape creates one load context for the module entry assembly, loads the assembly through that context, and then finds the module type using the shared contract interfaces already loaded by the host.

using System.Reflection;
using SharpClaw.Contracts.Modules;
using SharpClaw.ModuleHost.InProcess;

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpClaw.ModuleHost.InProcess:

Package Downloads
SharpClaw.ModuleHost.OutOfProcess

Runs SharpClaw .NET modules in the default out-of-process host model over the SharpClaw foreign-module protocol.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha 2,669 7/5/2026