What is a .NET application domain?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
An application domain, usually called an AppDomain, is a .NET runtime isolation boundary inside a process. In classic .NET Framework it was an important way to separate loaded code, configuration, and some failure handling without creating a whole new operating-system process.
What an AppDomain Does
A process is the operating-system boundary. An AppDomain is a CLR boundary inside that process.
Historically, AppDomains were used to:
- isolate assemblies loaded by different components
- unload groups of assemblies together
- run plugins with some separation from the host
- keep faults from crashing unrelated managed code as easily
- apply different configuration or probing behavior
You can think of it as "lighter than a process, heavier than a normal object boundary."
Why AppDomains Existed
In .NET Framework, assemblies loaded into the default AppDomain could not be unloaded individually. If you wanted to load plugin code, execute it, and later unload it, the usual solution was to create a separate AppDomain and tear that whole domain down when you were done.
A simplified .NET Framework-style example:
This was attractive for plugin hosts, test runners, and ASP.NET-style application isolation.
The Important Modern Caveat
If you are using modern .NET, meaning .NET Core, .NET 5, .NET 6, and later, AppDomains are much less central. Microsoft documentation is clear that creating and unloading multiple AppDomains is a .NET Framework-era concept. Modern .NET has a single AppDomain per process for most practical purposes, and AssemblyLoadContext is the modern mechanism for dynamic assembly loading and unloading.
That means older explanations are only partly correct today. They describe the historical role of AppDomains, but not the recommended design for current .NET applications.
AppDomain in .NET Framework vs Modern .NET
In .NET Framework:
- multiple AppDomains per process were a real design tool
- unloading an AppDomain unloaded the assemblies inside it
- remoting and cross-domain calls were common in some systems
In modern .NET:
- multiple unloadable AppDomains are not the normal model
- process isolation or
AssemblyLoadContextis preferred - many old AppDomain-related APIs exist mainly for compatibility
So when someone asks "What is an AppDomain?" the honest answer depends on which runtime they mean.
AppDomain Data and Introspection
Even in modern .NET, AppDomain.CurrentDomain still exists and is useful for process-level runtime information:
This is common for diagnostics and environment discovery. It does not mean you should build a new isolation architecture around AppDomains in modern runtimes.
The Modern Replacement: AssemblyLoadContext
If the real need is dynamic plugin loading and unloading in current .NET, use AssemblyLoadContext instead of AppDomain-based patterns.
Example:
This is the modern answer to many problems that older articles solved with AppDomains.
When AppDomains Still Matter Conceptually
Even if you do not create custom AppDomains anymore, the concept still helps explain:
- why
AppDomain.CurrentDomainexists - how older ASP.NET and .NET Framework hosts isolated applications
- why some legacy plugin systems look the way they do
- why some APIs are marked as framework-specific or compatibility-oriented
So AppDomains are still worth understanding, especially when maintaining legacy code.
Common Pitfalls
- Assuming AppDomains are still the recommended isolation mechanism in modern .NET.
- Reading .NET Framework examples and applying them unchanged to .NET 6 or .NET 8 code.
- Confusing process isolation with AppDomain isolation; they are not the same thing.
- Expecting to unload a single assembly directly in .NET Framework when the real unload unit was the AppDomain.
- Using AppDomain concepts for new plugin systems when
AssemblyLoadContextis the better fit.
Summary
- An AppDomain is a CLR isolation boundary inside a process.
- It was very important in classic .NET Framework for loading and unloading code safely.
- In modern .NET, AppDomains are mostly a compatibility concept rather than the main extensibility tool.
- '
AppDomain.CurrentDomainis still useful for runtime information.' - For new plugin-loading designs, prefer
AssemblyLoadContextover AppDomain-based patterns.
Related reading
- What is a NullReferenceException, and how do I fix it?
- What is a Portable Class Library?
- What is a Predicate Delegate and where should it be used?
- What is a predicate in c?
- What is a proper implementation of the IAsyncResult interface?
- What is a quick way to force CRLF in C / .NET?
- What is a replacement method for Task.Run in .NET 4.0 using C?
- What is a singleton in C?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.