(customer reported over email)
If runtime fails to allocate the instance of the FirstChanceExceptionEventArgs. it passes null to the first chance exception handler:
|
// Get the arguments to be passed to the delegate callback. Incase of any |
|
// problem while allocating the event args, we will return a NULL. |
|
ExceptionNotifications::GetEventArgsForNotification(notificationType, &gc.oEventArgs, |
|
&gc.oCurrentThrowable); |
. The typical implementation of first chance exception handler does not expect FirstChanceExceptionEventArgs to be null so this situation will lead to infinite recursion and eventual stack overflow.
We should either document this and take a breaking change to change the eventhandler argument to be nullable; or change the runtime to fail fast in this situation instead. (I think fail fasting is fine since the app is very likely going to crash anyway.)
(customer reported over email)
If runtime fails to allocate the instance of the FirstChanceExceptionEventArgs. it passes null to the first chance exception handler:
runtime/src/coreclr/vm/excep.cpp
Lines 9820 to 9823 in b19edc0
We should either document this and take a breaking change to change the eventhandler argument to be nullable; or change the runtime to fail fast in this situation instead. (I think fail fasting is fine since the app is very likely going to crash anyway.)