I have a multithreaded application that activate multiple Mono domains from native code. Each domain has it's own thread. I use the following code to activate a domain:
///Create a new domain.
m_domain = mono_domain_create_appdomain((char*) name.c_str(), NULL);
///Activate the domain.
mono_domain_set(m_domain, 0);
///Register the current thread
mono_thread_attach(m_domain);
///Invoke some code ...
mono_runtime_invoke (m_method, m_objectInstance, NULL, &exception);
But when I unload a domain the application crash :
mono_domain_unload(m_domain);
When I execute the code without threading, the application domains are unloaded correctly.