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

Originator:sindresorhus
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
 
Summary:
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:

```swift
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.

Version:
10.13.5

Notes:
More info: https://docs.fabric.io/apple/crashlytics/os-x.html#uncaught-exceptions

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

Comments

Duplicate

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 bugreport.apple.com 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!