Core.AppDomain.Host 2.0.0.26263

dotnet add package Core.AppDomain.Host --version 2.0.0.26263
                    
NuGet\Install-Package Core.AppDomain.Host -Version 2.0.0.26263
                    
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="Core.AppDomain.Host" Version="2.0.0.26263" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Core.AppDomain.Host" Version="2.0.0.26263" />
                    
Directory.Packages.props
<PackageReference Include="Core.AppDomain.Host" />
                    
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 Core.AppDomain.Host --version 2.0.0.26263
                    
#r "nuget: Core.AppDomain.Host, 2.0.0.26263"
                    
#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 Core.AppDomain.Host@2.0.0.26263
                    
#: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=Core.AppDomain.Host&version=2.0.0.26263
                    
Install as a Cake Addin
#tool nuget:?package=Core.AppDomain.Host&version=2.0.0.26263
                    
Install as a Cake Tool

Net4x.AppDomain.Host

The program that is a child application domain.

This is not a standalone package. It is built as a net8.0 executable and shipped inside the Net4x.AppDomain package under tools/net8.0/, where HostLocator finds it. One process is started per domain; you never reference this assembly or invoke it yourself.

parent process                          this program (one per domain)
──────────────────────────────          ────────────────────────────────────────
AppDomain.CurrentDomain
  .CreateChildDomain("worker")
        │  dotnet exec Net4x.AppDomain.Host.dll --name worker --base … --parent-pid …
        │                                       │
        │  <── stdout: "READY <port> <uri>"     ├─ TcpServerChannel(0) on 127.0.0.1
        │                                       ├─ publishes IDomainController
        │                                       ├─ assembly resolver rooted at --base
        │                                       └─ watchdog on the parent process
        ▼
ChildAppDomain ───── remoting ─────────>  DomainController

Command line

Argument Meaning
--name <text> Friendly name, used in diagnostics
--base <dir> ApplicationBase: the root for assembly probing
--private-bin <paths> Extra probe directories, separator-delimited
--config <file> Configuration file the domain should read
--parent-pid <id> Process to watch; the domain exits when it dies
--filter-level <Low\|Full> Deserialization filter level inside the domain

Arguments are passed as quoted pairs. A trailing backslash in a path is doubled before quoting — otherwise "C:\dir\" would escape its own closing quote on Windows and swallow every argument after it.

The startup handshake

The host prints exactly one line to stdout when it is ready to serve:

READY <port> <controllerUri>

The child picks its own port (binding 0 and reporting back), which removes the bind race a parent-chosen port would have. The parent reads that line with a timeout, then connects to tcp://127.0.0.1:<port>/<controllerUri>.

Two consequences worth respecting when changing this program:

  • stdout is a protocol. Anything this host wants to say goes to stderr. A stray Console.WriteLine before the handshake would be parsed as the READY line, or would delay it past the parent's timeout. Output written by hosted code is fine — it is forwarded to the parent's ChildAppDomain.OutputReceived after the handshake completes.
  • A failure before READY must be loud. The parent captures everything the child wrote and includes it in the exception, because "the domain would not start" is otherwise miserable to diagnose.

What it does

  • Publishes one well-known object, IDomainController, at an unguessable uri. Everything else the parent reaches is a reference the controller handed back.
  • Resolves assemblies from ApplicationBase, then PrivateBinPath, then the host's own directory, and finally asks the parent — which can answer with a path or with raw bytes, since an Assembly cannot cross a process boundary.
  • Forwards events: unhandled exceptions (as text, since an arbitrary exception type may not be loadable in the parent) and assembly loads (as full names, since AssemblyName.GetObjectData throws PlatformNotSupportedException off .NET Framework).
  • Watches the parent and exits when it disappears, so a crashed parent leaves no orphan processes holding ports. A polled process handle is used rather than a Windows job object, so the behaviour is the same on Linux and macOS.
  • Keeps created MarshalByRefObjects alive, since the remoting layer's proxy table holds only weak references and a collection would otherwise take a live worker away mid-session.

Security

The channel binds 127.0.0.1 only, so a domain is never reachable off the machine, and the controller uri carries 128 bits of entropy delivered over the child's stdout.

That is hardening, not a security boundary: another process running as the same user can read the child's output or attach a debugger. Domains isolate code against faults, not against malice.

Building

Built automatically by Net4x.AppDomain.Tests and packed into Net4x.AppDomain. To build alone:

dotnet build Net4x.AppDomain.Host\Net4x.AppDomain.Host.csproj -c Release
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Core.AppDomain.Host:

Package Downloads
Core.AspNet.Web.Remoting

.NET Remoting and AppDomain hosting for the ported ASP.NET: *.rem endpoints, mode="StateServer" over remoting, ApplicationHost.CreateApplicationHost, ApplicationManager, and several recycled applications behind one Kestrel.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0.26263 67 9/20/2026