m_pEventChannel(NULL),
m_fAssertOnTargetInconsistency(false),
m_runtimeOffsetsInitialized(false),
- m_writableMetadataUpdateMode(LegacyCompatPolicy)
+ m_writableMetadataUpdateMode(LegacyCompatPolicy),
+ m_isBlockedOnGarbageCollectionEvent(false)
{
_ASSERTE((m_id == 0) == (pShim == NULL));
{
PUBLIC_API_ENTRY(this);
+ this->m_isBlockedOnGarbageCollectionEvent = false;
+
if (m_pShim == NULL) // This API is moved off to the shim
{
// bias towards failing with CORDBG_E_NUETERED.
case DB_IPCE_BEFORE_GARBAGE_COLLECTION:
{
{
+ this->m_isBlockedOnGarbageCollectionEvent = true;
PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent);
pCallback4->BeforeGarbageCollection(static_cast<ICorDebugProcess*>(this));
}
case DB_IPCE_AFTER_GARBAGE_COLLECTION:
{
{
+ this->m_isBlockedOnGarbageCollectionEvent = true;
PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent);
pCallback4->AfterGarbageCollection(static_cast<ICorDebugProcess*>(this));
}
}
else
{
- DT_CONTEXT* managedContext;
- hr = thread->GetManagedContext(&managedContext);
- *pContext = *managedContext;
+ if (this->m_isBlockedOnGarbageCollectionEvent)
+ {
+ hr = this->GetDataTarget()->GetThreadContext(threadID, CONTEXT_FULL, contextSize, context);
+ }
+ else
+ {
+ DT_CONTEXT* managedContext;
+ hr = thread->GetManagedContext(&managedContext);
+ *pContext = *managedContext;
+ }
}
}
EX_CATCH
hr = E_INVALIDARG;
}
- hr = thread->SetManagedContext(pContext);
+ if (this->m_isBlockedOnGarbageCollectionEvent)
+ {
+ hr = this->m_pMutableDataTarget->SetThreadContext(threadID, contextSize, context);
+ }
+ else
+ {
+ hr = thread->SetManagedContext(pContext);
+ }
}
EX_CATCH
{