Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧Deps
Other
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7284 +/- ##
=============================================
- Coverage 85.260% 85.253% -0.008%
=============================================
Files 477 478 +1
Lines 28577 28589 +12
Branches 12418 12425 +7
=============================================
+ Hits 24365 24373 +8
- Misses 4165 4166 +1
- Partials 47 50 +3
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7714225 | 1213.24 ms | 1252.28 ms | 39.04 ms |
| 1357911 | 1222.84 ms | 1258.38 ms | 35.54 ms |
| 45eb835 | 1210.40 ms | 1233.39 ms | 22.99 ms |
| d540ef3 | 1214.37 ms | 1241.06 ms | 26.69 ms |
| b8fcca6 | 1228.85 ms | 1259.59 ms | 30.74 ms |
| ffe0649 | 1213.35 ms | 1248.64 ms | 35.29 ms |
| 5ca545a | 1219.06 ms | 1244.59 ms | 25.53 ms |
| 015d376 | 1187.58 ms | 1211.28 ms | 23.70 ms |
| c519f01 | 1211.75 ms | 1244.48 ms | 32.73 ms |
| 1357911 | 1224.57 ms | 1261.00 ms | 36.43 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7714225 | 24.14 KiB | 1.07 MiB | 1.05 MiB |
| 1357911 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| 45eb835 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| d540ef3 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| b8fcca6 | 24.14 KiB | 1.08 MiB | 1.06 MiB |
| ffe0649 | 24.14 KiB | 1.06 MiB | 1.04 MiB |
| 5ca545a | 24.14 KiB | 1.06 MiB | 1.04 MiB |
| 015d376 | 24.14 KiB | 1.09 MiB | 1.07 MiB |
| c519f01 | 24.14 KiB | 1.08 MiB | 1.06 MiB |
| 1357911 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
Previous results on branch: repro/cocoa-287-nsexception-wrong-stacktrace
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1425788 | 1214.88 ms | 1249.04 ms | 34.17 ms |
| f1f0df6 | 1214.88 ms | 1248.69 ms | 33.82 ms |
| 01e98f7 | 1215.36 ms | 1251.42 ms | 36.06 ms |
| 999f921 | 1226.70 ms | 1260.00 ms | 33.30 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1425788 | 24.14 KiB | 1.10 MiB | 1.07 MiB |
| f1f0df6 | 24.14 KiB | 1.08 MiB | 1.06 MiB |
| 01e98f7 | 24.14 KiB | 1.10 MiB | 1.08 MiB |
| 999f921 | 24.14 KiB | 1.10 MiB | 1.08 MiB |
philprime
left a comment
There was a problem hiding this comment.
Approving this as it LGTM, but please consider my feedback
# Conflicts: # Sentry.xcodeproj/project.pbxproj
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
Reference to GH issue was missing. Closes #4472 |

📜 Description
Fixes missing stack traces for
NSExceptionobjects reported viaNSApplication.shared.reportException(_:)on macOS. When exceptions are reported (not raised),callStackReturnAddressesis empty, resulting in stack traces showingnullin Sentry.In this case, we capture the current thread's stack trace using
sentrycrashsc_initSelfThreadas a fallback.This does affect grouping, as these are now detected as new events.
Before
https://sentry-sdks.sentry.io/issues/7219136196/?project=5428557&query=is%3Aunresolved&referrer=issue-stream
After
https://sentry-sdks.sentry.io/issues/7219236592/?project=5428557&query=is%3Aunresolved&referrer=issue-stream
💡 Motivation and Context
NSException.callStackReturnAddressesis only populated when an exception is raised viaexception.raise(). WhenNSApplication.shared.reportException(_:)is used, the exception is passed around without being raised, leavingcallStackReturnAddressesempty. This fix mirrors Xcode's crash report behavior by capturing the current thread's stack trace when the exception's stack is unavailable.Closes #COCOA-287
💚 How did you test it?
Added unit test, run sample app.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.