2

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.

1 Answer 1

1

I was calling the function mono_assembly_close, before mono_domain_unload :

mono_assembly_close(m_assembly);

So I removed this call, and created a critical section for the unloading code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.