getsentry / getsentry/sentry-dotnet
Check for crash reports when capturing errors on mobile (next Major)
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
### Problem Statement
.NET 11 should be adding. in proc crash report logging that we can hopefully leverage to provide better exception reporting on mobile targets.
See:
- https://github.com/dotnet/runtime/pull/128105
The .crashreport.json files include a much richer stack trace than we currently get for native crashes or crashes with a mix of native and managed frames:
...
"threads": [
{
"is_managed": "true",
"crashed": "true",
"native_thread_id": "0x1adc",
"ctx": {
"IP": "0x7e6f5e5a10f4",
"SP": "0x7fffea6244e0",
"BP": "0x7fffea6244e0"
},
"stack_frames": [
{
"is_managed": "false",
"stack_pointer": "0x7fffea6244e0",
"native_address": "0x7e6f5e5a10f4"
},
{
"stack_pointer": "0x7fffea624520",
"native_address": "0x7e6e1af96f98",
"native_offset": "0x78",
"method_name": "Maui.Diagnostics.Playground.Features.Scenarios.NativeCrashInterop.MixedStackNative",
"is_managed": "true",
"token": "0x6000093",
"il_offset": "0x0",
"filename": "Maui.Diagnostics.Playground",
"timestamp": "0xcbf5c1ba",
"sizeofimage": "0x36a00",
"guid": "{8ae4c3d5-286d-487a-adf7-39bfa6d48ad3}"
},
...
Currently Sentry just shows unsymbolicated Native frames:
```
SIGSEGV: Segfault
libcrashnativekit 0x7e6f5e5a10f4 null
libcrashnativekit 0x7e6f5e5a10dc null
libcrashnativekit 0x7e6f5e5a10c8 null
libcrashnativekit 0x7e6f5e5a0f14 null
libcrashnativekit 0x7e6f5e5a0fdc crash_native_mixed_stack
0x7e6e1af96f94 null
```
And when sentry-native captures mixed stack traces it's not much better (since sentry-native can't unwind managed frames):
### Solution Brainstorm
We should be able to pull the crash report from disk when building the event in Sentry):
- If it's a native crash, we'd likely have to do that in sentry-native since this will be the SDK that captures native exceptions
- If it's a managed crash, it still might be useful if we have a mix of native/managed frames in the stack trace
Contributor guide
Research direction
Start by reviewing the linked .NET runtime pull request and the mobile error-event construction in Sentry, then compare how sentry-native handles native crashes. Determine where .crashreport.json files are available for managed and native captures. Done means mobile events include the richer mixed native/managed stack information without breaking existing crash reporting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- mobile-dev, observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100