Skip to content

FirstChanceExceptionEventArgs passed into FirstChanceException handler can be null #123590

Description

@jkotas

(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.)

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions