Index: mini/mini.c =================================================================== --- mini/mini.c (revision 84093) +++ mini/mini.c (working copy) @@ -8703,6 +8708,7 @@ void mono_jit_thread_attach (MonoDomain *domain) { + mono_domain_set (domain, TRUE); #ifdef HAVE_KW_THREAD if (!mono_lmf_addr) { mono_thread_attach (domain); Index: mini/mini-x86.c =================================================================== --- mini/mini-x86.c (revision 84093) +++ mini/mini-x86.c (working copy) @@ -3549,7 +3549,7 @@ if (method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED) { /* Might need to attach the thread to the JIT */ - if (lmf_tls_offset != -1) { + if (0 && lmf_tls_offset != -1) { guint8 *buf; code = emit_tls_get ( code, X86_EAX, lmf_tls_offset);