-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Symbolication for AOT-compiled stack traces on iOS #2180
Comments
Note - works in debug mode. Also works in debug or release mode on the simulator - just not on a real device. |
Just a note, Android does not have this issue. It symbolicates fine: |
Found I can get at at the logs in release mode by connecting the iOS device via USB and running:
With
|
Well, I found the problem.
This is returning false. It's defined as: public bool IsPortableCodeView => MinorVersion == PortablePdbVersions.PortableCodeViewVersionMagic; And in the case of the released iOS app, The problem appears to be caused by dotnet assembly trimming, which is not something that can be disabled for iOS apps. (I've tried various options with no success as of yet.) Building in release mode will create a regular dll and pdb where you'd expect them. For example:
But then it will write a trimmed dll to the app bundle at:
Both dll's will have the same guid part of the debug id, but the last component (the timestamp) will vary. Check with
(Note the output of I can see the same detail in Rider's "Assembly Explorer": The non-trimmed DLL's debug headers: The trimmed DLL's debug headers: Notice that the non-trimmed version has valid values for In the non- trimmed headers, |
Not sure what to do about this. At runtime, we need the One thought I had was that it might be possible to use an MSBuild tasks with ILLink custom steps to read the full debug ID from the un-trimmed assembly and write it to another location (such as an @bruno-garcia @vaind - thoughts? |
Oh, and note that both parts of the Code ID differ as well. Debug ID: vs. Debug ID: ... which makes sense because the trimmed version is smaller, and the timestamp of the non-trimmed version is deterministic |
Seems to match the specification
We may need to change the lookup logic to support this properly @Swatinem ? |
@vaind - I think you're saying that I'm seeing the first part of the spec there ( |
I'm not very familiar with the symbolication part of this, that's why I've tried pinging @Swatinem, I think he have originally programmed that. |
But yes, my suspicion is we're not handling both scenarios. |
TBH, feels like a .NET linker or SDK bug to me. I mean, if you set Even so, if we can find a workaround, that would be useful. I can easily change the code in the SDK to handle both parts of the spec. Not sure what would need to change on the back-end. |
Note, I tried sending the debug id with the age instead, but that did not work either. I didn't expect it to though, as it still doesn't match the PDB sent. Example event: Debug ID: The Debug ID on the PDB is |
|
Forget the last post. I found that it's not the Trimming and Stripping are different tools. (Who knew? 😅 ) The good news is, I can turn stripping off with The bad news is, symbolication is still not working. Now I get status "Unreferenced". Yet, if I click "Open in Settings", it is found there. What am I missing? |
FYI, I figured out (through various GitHub issues, as there are no good docs) that |
I also believe this might be an upstream bug. The PDB is deterministic, and the dll referencing it should retain that fact. Trimming the DLL does not touch the PDB in any way, does it? If not, it should indeed keep the exact same reference to the PDB. I can take a look at the last issue without |
Well, the stack frame simply has no |
I was mistaken originally.
Still looking at exactly why, but I think it has to do with AOT compilation. I think we'll need to do something more than we currently do for AOT compiled assemblies. Perhaps this is what #579 was about? (I'm still learning about all these things.) |
#579 won't help here, as the stacktrace string it was parsing is not available at runtime. However, we do still need some way to deal with full-AOT compiled apps - as with iOS. @Swatinem - You are correct, I think for now we'll need to document that .NET symbolication doesn't work on iOS, and work on a more comprehensive solution. |
@mattjohnsonpint IIUC |
Not sure if relevant but when I looked at this years ago (Xamarin.iOS) it was required 2 lookups to get to the C# line numbers: The "AOT Id", likely a debug_id for dsyms would find the native symbols. And from there it would still rely on the .net pdb to do a further lookup. For that reason Mono encoded 2 debugs in a single stack trace: On |
Agreed, but I currently don't get stack traces that include either We also don't get |
Blocked on https://github.com/getsentry/team-stacktrace/issues/43. Will resume later. |
We possibly can support iOS through Native AOT for apps targeting .NET 8 and later. Assuming this lands: If so, this ticket, given its complexity, becomes lower priority. That is, if Mono AOT can be replaced with Native AOT. And what we could focus on is: |
We'll encourage you to try steps for NativeAOT targetting iOS as mentioned in this blog post on any .NET8 Preview 6 or 7 builds and give us feedback - https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-6/#support-for-targeting-ios-platforms-with-nativeaot |
@bruno-garcia @SamMonoRT support for NativeAOT on .net8-ios works fine with Sentry, I'm preparing a PR #2820 |
For completeness, it doesn't look like we can add support for this to MonoAOT because of the missing information. This is all the info we have available at runtime: var realFrame = stackFrame.Frame as StackFrame;
_options.LogDebug("Capturing frame {0}", frame.ToUtf8Json());
_options.LogDebug("### ToString = {0}", realFrame!.ToString());
_options.LogDebug("### Has Native Image = {0}", realFrame.HasNativeImage());
_options.LogDebug("### Native Image Base = 0x{0:x}", realFrame.GetNativeImageBase());
_options.LogDebug("### Native Interface pointer = 0x{0:x}", realFrame.GetNativeIP());
_options.LogDebug("### Offset = {0}", realFrame.GetNativeOffset());
_options.LogDebug("### FileName = {0}", realFrame.GetFileName());
_options.LogDebug("### Line no = {0}", realFrame.GetFileLineNumber());
_options.LogDebug("### HasMethod = {0}", realFrame.HasMethod());
_options.LogDebug("### Method = {0}", realFrame.GetMethod());
_options.LogDebug("### ILOffset = {0}", realFrame.GetILOffset());
_options.LogDebug("===================="); Has the following output (the first line is from another log line above in the normal code):
|
Package
Sentry.Maui
.NET Flavor
.NET
.NET Version
7.0.102
OS
iOS
SDK Version
3.28.1
Steps to Reproduce
Sentry.Maui
Expected Result
Error in Sentry should include file names and line numbers in the stack trace.
Actual Result
No symbolication occurs.
Event:
https://sentry-sdks.sentry.io/issues/3936606932/events/6292f7f7ec3744e6a410e0bd111879ce/?project=5428537
The JSON of the event does not contain any
debug_meta
information, symbolication is not attempted.The text was updated successfully, but these errors were encountered: