Skip to content

Commit

Permalink
Fix extra stack frame on exception stack trace (#99263)
Browse files Browse the repository at this point in the history
A recently added diagnostic test has revealed that throwing an exception
from a funclet results in an extra frame on the stack trace that should
not be there.
This change fixes it in a manner equivalent to how the old EH handles that.
  • Loading branch information
janvorli authored Mar 6, 2024
1 parent ab1d93b commit 112240c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,13 @@ private static void DispatchEx(scoped ref StackFrameIterator frameIter, ref ExIn

DebugScanCallFrame(exInfo._passNumber, frameIter.ControlPC, frameIter.SP);

UpdateStackTrace(exceptionObj, exInfo._frameIter.FramePointer, (IntPtr)frameIter.OriginalControlPC, frameIter.SP, ref isFirstRethrowFrame, ref prevFramePtr, ref isFirstFrame, ref exInfo);
#if !NATIVEAOT
// Don't add frames at collided unwind
if (startIdx == MaxTryRegionIdx)
#endif
{
UpdateStackTrace(exceptionObj, exInfo._frameIter.FramePointer, (IntPtr)frameIter.OriginalControlPC, frameIter.SP, ref isFirstRethrowFrame, ref prevFramePtr, ref isFirstFrame, ref exInfo);
}

byte* pHandler;
if (FindFirstPassHandler(exceptionObj, startIdx, ref frameIter,
Expand Down

0 comments on commit 112240c

Please sign in to comment.