AppDomains vs AssemblyLoadContext
Why can’t you rely on AppDomains in .NET Core, and what replaces plugin unload scenarios?
Answers use simple, clear English.
Audio N/AQuick interview answer
AppDomains were a Framework isolation/unload primitive. .NET Core removed them. Use AssemblyLoadContext (collectible) for dynamic plugin load/unload, plus process isolation (separate containers/processes) when strong isolation is required.
Detailed answer
AppDomains were a Framework isolation/unload primitive. .NET Core removed them. Use AssemblyLoadContext (collectible) for dynamic plugin load/unload, plus process isolation (separate containers/processes) when strong isolation is required. Design plugins around clear interfaces and avoid static state leaks.
Real example & use case
Report renderer plugins loaded in collectible ALC and unloaded after job.
Pros & cons
Pros: ALC fits Core. Cons: unload is harder than AppDomain.Unload; leaks from rooted refs.