What is the difference between process and AppDomain in .NET?
Answer
A Process is an OS-level isolation boundary — its own memory space, handles, and security context. Starting a separate process provides complete isolation. A AppDomain (Application Domain) was a .NET Framework feature providing a lightweight isolation boundary within a single process — allowing multiple independent "mini-applications" to run in one process with isolated state and different permissions, enabling unloading of code. Uses: hosting environments (IIS, older plugin systems), isolated test runs. In .NET Core / .NET 5+: AppDomains are removed (except for the default AppDomain which exists for compatibility). Code that creates new AppDomains throws PlatformNotSupportedException. The replacement for runtime code isolation in .NET Core is: (1) AssemblyLoadContext (ALC): load and unload assemblies into isolated contexts — the new plugin system. (2) Separate processes. (3) Isolated containers/processes. AssemblyLoadContext.Collectible = true enables unloading of the loaded assemblies.
Previous
What is GC pressure and how do you diagnose and fix it?
Next
What is System.Text.Json and how does it compare to Newtonsoft.Json?