diff --git a/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp b/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp index 7ffaf3cab3afe..d2fa4c574b2c1 100644 --- a/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp +++ b/src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp @@ -811,11 +811,6 @@ PTR_VOID StackFrameIterator::HandleExCollide(PTR_ExInfo pExInfo) // Sync our 'current' ExInfo with the updated state (we may have skipped other dispatches) ResetNextExInfoForSP(m_RegDisplay.GetSP()); - // In case m_ControlPC is pre-adjusted, counteract here, since the caller of this routine - // will apply the adjustment again once we return. If the m_ControlPC is not pre-adjusted, - // this is simply an no-op. - m_ControlPC = m_OriginalControlPC; - m_dwFlags = curFlags; // The iterator has been moved to the "owner frame" (either a parent funclet or the main @@ -1830,7 +1825,9 @@ void StackFrameIterator::PrepareToYieldFrame() ASSERT(m_pInstance->IsManaged(m_ControlPC) || ((m_dwFlags & SkipNativeFrames) == 0 && (m_dwFlags & UnwoundReversePInvoke) != 0)); - if (m_dwFlags & ApplyReturnAddressAdjustment) + // Do not adjust the PC if ExCollide is set. In that case the m_ControlPC was copied from + // another stack frame iterator and it already has a correct value. + if ((m_dwFlags & (ApplyReturnAddressAdjustment | ExCollide)) == ApplyReturnAddressAdjustment) { m_ControlPC = AdjustReturnAddressBackward(m_ControlPC); } diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 2179c2cef934a..847d719ce3c66 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1209,9 +1209,6 @@ https://github.com/dotnet/runtime/issues/101363 - - https://github.com/dotnet/runtime/issues/101364 -