AppKit should crash on uncaught exception (NSApplicationCrashOnExceptions should default to true)

Number:rdar://41809382 Date Originated:04-Jul-2018 01:41 PM
Status:Open (Duplicate of 26841785) Resolved:
Product:macOS + SDK Product Version:10.13.5
Classification:Enhancement Reproducible:Always
By default, AppKit doesn't always crash on uncaught exceptions. It will catch exceptions thrown on the main thread, preventing the application from crashing, but it will also likely corrupt your process’s state. This is not a good default. It's better to crash than to end up in a corrupted state. This is what iOS does.

Developers can fix this bad behavior by setting the following:

UserDefaults.standard.register(defaults: ["NSApplicationCrashOnExceptions": true])

But most don't know about this, however, which means a lot of apps would silently corrupt their own process state without even knowing.

Steps to Reproduce:

Expected Results:
I expected `"NSApplicationCrashOnExceptions": true` to be the default behavior.

Actual Results:
`NSApplicationCrashOnExceptions` has to be manually enabled.


More info:

This could be fixed in a non-breaking matter by only defaulting to true when linked against the latest macOS SDK.



Marked as duplicate of rdar://26841785 by Apple.

By sindresorhus at July 10, 2018, 8:13 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!