What is the AppDomain concept in .NET Framework, and why was it removed from modern .NET?
Short answer
AppDomains in .NET Framework provided isolated execution boundaries within a single process, allowing multiple applications (or plugins) to run with separate loaded assemblies, security contexts, and the ability to unload one without affecting others -- but with significant…
Advertisement
AModel answer
AppDomains in .NET Framework provided isolated execution boundaries within a single process, allowing multiple applications (or plugins) to run with separate loaded assemblies, security contexts, and the ability to unload one without affecting others -- but with significant overhead from cross-domain marshaling for any communication. Modern .NET removed AppDomains (only a single default domain exists) in favor of the much lighter-weight AssemblyLoadContext for assembly isolation and Process-level isolation (containers, separate processes) for stronger security/fault boundaries, reflecting a simpler and more performant design given modern deployment practices.
// .NET Framework (legacy): AppDomain-based isolation
AppDomain domain = AppDomain.CreateDomain("PluginDomain");
// .NET Framework only -- not available in modern .NET
// Modern .NET equivalent: AssemblyLoadContext
var alc = new AssemblyLoadContext("PluginContext", isCollectible: true);Real-world example
A legacy Framework application relying on AppDomain-based plugin isolation must be redesigned around AssemblyLoadContext (for assembly-level isolation) or separate worker processes (for full fault isolation) when migrating to modern .NET.
Likely follow-ups
- What cross-domain communication overhead did AppDomains impose?
- Why is process isolation now preferred for strong security boundaries instead?
Related topics