From b35b67d24c211a73a1eed7213aef245dd0e0cbcc Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 17 Apr 2024 23:56:57 +0200 Subject: [PATCH] Move first chance exception notification so the !pe works (#101190) The recent addition of first chance exception notification for the new EH was comming too early, so when the notification occurred, the !pe SOS command was not able to get the actual exception yet - it was not accessible via the Thread::ExceptionState This change moves the notification to the first spot where the exception state points to the exception, so the !pe works. --- src/coreclr/vm/exceptionhandling.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 05b0b94036562c..9719e7e6dc1424 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -5655,8 +5655,6 @@ VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT* pE args[ARGNUM_0] = OBJECTREF_TO_ARGHOLDER(throwable); args[ARGNUM_1] = PTR_TO_ARGHOLDER(&exInfo); - FirstChanceExceptionNotification(); - pThread->IncPreventAbort(); //Ex.RhThrowEx(throwable, &exInfo) @@ -8127,6 +8125,7 @@ static void NotifyExceptionPassStarted(StackFrameIterator *pThis, Thread *pThrea { GCX_COOP(); pThread->SafeSetThrowables(pExInfo->m_exception); + FirstChanceExceptionNotification(); EEToProfilerExceptionInterfaceWrapper::ExceptionThrown(pThread); } else // pExInfo->m_passNumber == 2