The debugger/transport shutdown was not being called because we don't emulate
coreclr's DllMain DLL_PROCESS_DETACH callbacks. Adding the DLL_PROCESS_DETACH
DllMain callbacks will potentially crash deadlocks and other problems. Added the
debugger terminate/shutdown call to EEShutDown's first phase.
SessionState ePreviousState = m_eState;
m_eState = SS_Closed;
- if ((ePreviousState != SS_Opening_NC) && (ePreviousState != SS_Resync_NC) && (ePreviousState != SS_Closed))
+ if (ePreviousState != SS_Closed)
{
m_pipe.Disconnect();
}
// Signal the m_hSessionOpenEvent now to quickly error out any callers of WaitForSessionToOpen().
SetEvent(m_hSessionOpenEvent);
#endif // RIGHT_SIDE_COMPILE
-
- // Now let the transport thread shut itself down cleanly. This will take care of emptying the send queue
- // as well.
- WaitForSingleObject(m_hTransportThread, INFINITE);
}
// No other threads are now using session resources. We're free to deallocate them as we wish (if they
FastInterlockExchange((LONG*)&g_fForbidEnterEE, TRUE);
+#if defined(DEBUGGING_SUPPORTED) && defined(FEATURE_PAL)
+ // Terminate the debugging services in the first phase for PAL based platforms
+ // because EEDllMain's DLL_PROCESS_DETACH is NOT going to be called.
+ TerminateDebugger();
+#endif // DEBUGGING_SUPPORTED && FEATURE_PAL
+
if (g_fProcessDetach)
{
ThreadStore::TrapReturningThreads(TRUE);