-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat: Option for uncaught NSExceptions on macOS #4471
Conversation
Add a new option, enableReportingUncaughtExceptions, for reporting uncaught exceptions on macOS. AS SwiftUI applications on macOS can't easily set a Principal class in the Info.plist, especially when using the NSApplicationDelegate, our existing solution of the SentryCrashExceptionApplication doesn't work for them. This new option fixes that problem.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4471 +/- ##
=============================================
- Coverage 91.807% 91.797% -0.011%
=============================================
Files 610 611 +1
Lines 68235 68247 +12
Branches 24502 24496 -6
=============================================
+ Hits 62645 62649 +4
- Misses 5498 5505 +7
- Partials 92 93 +1
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
630ddf4 | 1216.50 ms | 1235.94 ms | 19.44 ms |
b15521e | 1246.51 ms | 1262.96 ms | 16.45 ms |
f0737f6 | 1220.43 ms | 1236.44 ms | 16.01 ms |
5be7a7c | 1223.12 ms | 1236.61 ms | 13.49 ms |
1ee5a37 | 1209.37 ms | 1222.04 ms | 12.68 ms |
3297d6e | 1209.27 ms | 1231.19 ms | 21.92 ms |
addcf42 | 1247.33 ms | 1253.58 ms | 6.25 ms |
d605f55 | 1219.76 ms | 1237.55 ms | 17.80 ms |
9f0d9e0 | 1212.49 ms | 1220.27 ms | 7.78 ms |
ecd9ecd | 1191.76 ms | 1216.92 ms | 25.16 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
630ddf4 | 20.76 KiB | 432.37 KiB | 411.61 KiB |
b15521e | 21.58 KiB | 573.17 KiB | 551.59 KiB |
f0737f6 | 20.76 KiB | 437.12 KiB | 416.36 KiB |
5be7a7c | 21.58 KiB | 671.90 KiB | 650.32 KiB |
1ee5a37 | 21.58 KiB | 670.39 KiB | 648.81 KiB |
3297d6e | 21.58 KiB | 418.44 KiB | 396.86 KiB |
addcf42 | 22.85 KiB | 413.42 KiB | 390.57 KiB |
d605f55 | 21.90 KiB | 707.58 KiB | 685.68 KiB |
9f0d9e0 | 21.58 KiB | 424.28 KiB | 402.70 KiB |
ecd9ecd | 20.76 KiB | 420.23 KiB | 399.47 KiB |
Previous results on branch: feat/uncaught-ns-exceptions
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
a3b8d95 | 1245.37 ms | 1258.92 ms | 13.55 ms |
4afcecf | 1242.71 ms | 1260.61 ms | 17.90 ms |
27158ef | 1213.46 ms | 1239.08 ms | 25.62 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
a3b8d95 | 21.90 KiB | 707.97 KiB | 686.06 KiB |
4afcecf | 21.90 KiB | 708.90 KiB | 687.00 KiB |
27158ef | 21.90 KiB | 707.97 KiB | 686.07 KiB |
Sorry @philipphofmann, I will only be able to review this on Monday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look straightforward, but CI is not happy.
- some minor comments.
📜 Description
Add a new option, enableReportingUncaughtExceptions, for reporting uncaught exceptions on macOS. AS SwiftUI applications on macOS can't easily set a Principal class in the Info.plist, especially when using the NSApplicationDelegate, our existing solution of the SentryCrashExceptionApplication doesn't work for them. This new option fixes that problem.
Docs PR: getsentry/sentry-docs#11671
💡 Motivation and Context
A customer reported the current setup doesn't work for them when using
NSApplicationDelegate
.💚 How did you test it?
Unit tests and manually with the simulator. I compared the new way (
enableReportingUncaughtExceptions
) with the old way ofSentryCrashExceptionApplication
and all three tests worked the same way. Report exception seems a bit broken, but that was already the case before. We should look at this individually.Simulator tests
I added three different ways for reporting NSExcption.
raise()
on it.NSApplication.shared.reportException(exception)
macOS-SwiftUI
Raise
https://sentry-sdks.sentry.io/issues/6016580829/events/1cfac198b76944878b21610eac25b941/?project=5428557

Report
https://sentry-sdks.sentry.io/issues/6016587329/events/ebefcb69480243cebbc4b42ba15519e6/?project=5428557

NSRange
https://sentry-sdks.sentry.io/issues/6016594158/events/31eabb811c0d47aeaa8d997d087f878b/?project=5428557

macOS-Swift
Raise
https://sentry-sdks.sentry.io/issues/6016621535/events/3fcff45068e3481486617c4eb447d818/?project=5428557

Report
https://sentry-sdks.sentry.io/issues/6016587329/events/3c402084c01442eea986fc8cd6476ec7/?project=5428557

NSRange
https://sentry-sdks.sentry.io/issues/6016756316/events/21241a61000c4e278aa6908f26b35ddf/?project=5428557

Xcode Crash Reports
Xcode Crash Report Raise
Xcode Crash Report Report
Xcode Crash Report NSRange
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps