Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAT-6261] Detect uncaught objc exceptions on Mac Catalyst and iOSAppOnMac #1053

Merged

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Mar 26, 2021

Goal

iOS apps running on Mac Catalyst or on Macs with Apple Silicon were not having uncaught exceptions reported when thrown from a UI event handler.

The normal mechanisms we use to detect exceptions (NSUncaughtExceptionHandler or std::terminate_handler) are not triggered due to the way AppKit has historically dealt with exceptions.

Changeset

Bugsnag now hooks into -[NSApplication reportException:] to detect uncaught exceptions.

Testing

Tested using a sample project targeting Mac Catalyst and on a Mac mini with Apple silicon.

@github-actions
Copy link

Infer: No issues found 🎉

OCLint: No issues found 🎉

Bugsnag.framework binary size increased by 552 bytes from 1,101,568 to 1,102,120

Generated by 🚫 Danger

@nickdowell nickdowell force-pushed the nickdowell/ios-app-on-mac-uncaught-exception-handling branch from 5620944 to 2613411 Compare March 26, 2021 16:56
@nickdowell nickdowell marked this pull request as ready for review March 29, 2021 07:43
// iOS apps behave a little differently when running on macOS via Catalyst or
// on Apple Silicon. Uncaught NSExceptions raised while handling UI events get
// caught by AppKit and are not propagated to NSUncaughtExceptionHandler or
// std::terminate_handler, therefore we need another way to detect them...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the feedback number here as a reference for future travelers, both to note that its related to an ongoing issue and to make it easier to know when to remove this code if the issue is ever addressed. (maybe also in the changelog?)

@nickdowell nickdowell merged commit fd2fcba into next Mar 29, 2021
@nickdowell nickdowell deleted the nickdowell/ios-app-on-mac-uncaught-exception-handling branch March 29, 2021 10:52
@nickdowell nickdowell mentioned this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants