return false; // bad transition
}
+ // this is an ordinary transition to managed code
+ // GC threads should not do that
+ ASSERT(!IsGCSpecial());
+
// save the previous transition frame
pFrame->m_savedPInvokeTransitionFrame = m_pTransitionFrame;
}
// Run pre-mortem callbacks while we still can run managed code and not holding locks.
- if (g_threadExitCallback != NULL)
+ // NOTE: background GC threads are attached/suspendable threads, but should not run ordinary
+ // managed code. Make sure that does not happen here.
+ if (g_threadExitCallback != NULL && !pDetachingThread->IsGCSpecial())
{
g_threadExitCallback();
}