AppDomains does not get its own default thread. You can execute code in another AppDomain using existing threads, or call a method in AppDomain that creates new threads. In fact, unless you specifically create additional threads that invoke code in another domain, they will be executed in the main thread of the process.
From the AppDomain Documentation
Multiple application domains can run in one process; however, there is no one-to-one correlation between application domains and threads. Several threads can belong to the same application domain, and while this thread is not limited to one application domain at any given time, the thread runs in the same application domain.
In your example, you create threads (or, more specifically, a thread pool), and in this way the code will work in these threads. However, I'm not sure I would recommend creating AppDomains in thread pool threads like this.
Unloading the AppDomain cancels any threads in the AppDomain. I honestly donβt know how this thread will react to this. Read more about unloading here .
Brian rasmussen
source share