.NET Application Domains

Application domains, or AppDomains, are units of isolation, security boundaries, and do the loading and unloading for applications in the .NET runtime. Multiple application domains can run in a single process. Each can have one or many threads, and a thread can switch application domains at runtime.

The .NET managed assemblies require interface methods invoked by the C++ layer to be in the same AppDomain as that of the .NET DLL. If not, an exception is thrown because the thread is unable to cross AppDomain boundaries.