Skip to content

Commit b78c19a

Browse files
Notify debuggers on rethrown exceptions (#116246)
1 parent 43edad5 commit b78c19a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,18 @@ public static void RhUnwindAndIntercept(ref ExInfo exInfo, UIntPtr interceptStac
739739
public static void RhRethrow(ref ExInfo activeExInfo, ref ExInfo exInfo)
740740
{
741741
#if NATIVEAOT
742+
743+
#if TARGET_WINDOWS
744+
// Alert the debugger that we threw an exception.
745+
InternalCalls.RhpFirstChanceExceptionNotification();
746+
#endif // TARGET_WINDOWS
747+
742748
// trigger a GC (only if gcstress) to ensure we can stackwalk at this point
743749
GCStress.TriggerGC();
744750

745751
InternalCalls.RhpValidateExInfoStack();
746-
#endif
752+
#endif // NATIVEAOT
753+
747754
// We need to copy the exception object to this stack location because collided unwinds
748755
// will cause the original stack location to go dead.
749756
object rethrownException = activeExInfo.ThrownException;

0 commit comments

Comments
 (0)