diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h index daea9c67f5b99..60ec069b18e6b 100644 --- a/src/coreclr/debug/daccess/dacimpl.h +++ b/src/coreclr/debug/daccess/dacimpl.h @@ -2001,12 +2001,15 @@ class DacStackReferenceWalker : public DefaultCOMImplGetFilterContext() == NULL && mThread->GetProfilerFilterContext() == NULL) { - T_CONTEXT ctx; mDac->m_pTarget->GetThreadContext(mThread->GetOSThreadId(), CONTEXT_FULL, sizeof(ctx), (BYTE*)&ctx); mThread->SetProfilerFilterContext(&ctx); + clearProfilerFilterContext = true; } // Setup GCCONTEXT structs for the stackwalk. @@ -2033,6 +2036,11 @@ class DacStackReferenceWalker : public DefaultCOMImplStackWalkFrames(DacStackReferenceWalker::Callback, &gcctx, flagsStackWalk); + if (clearProfilerFilterContext) + { + mThread->SetProfilerFilterContext(NULL); + } + // We have filled the user's array as much as we could. If there's more data than // could fit, mHead.Next will contain a linked list of refs to enumerate. mCurr = mHead.next;