title: Unloading Mono domains in multithreaded context
body: <p>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:</p>
  
  <pre><code>///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, &amp;exception);
  </code></pre>
  
  <p>But when I unload a domain the application crash :</p>
  
  <pre><code>mono_domain_unload(m_domain);
  </code></pre>
  
  <p>When I execute the code without threading, the application domains are unloaded correctly. </p>