You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having trouble getting source context working for MAUI Android apps, but can get them for non-MAUI Android apps.
The same result occurs whether uploading the sources to Sentry, or embedding them in the PDBs. However, it's easier to see by embedding because we can validate sources are missing before sending any events.
Consider:
dotnet new android -n AndroidApp1
cd AndroidApp1
dotnet build -c Release -p:EmbedAllSources=true
sentry-cli dif check bin/Release/net7.0-android/AndroidApp1.pdb
Sources do appear if compiling in Debug configuration.
Needs more investigation to figure out if sources aren't being found (which we could document or workaround), or if the format is different somehow (which would require a change to Symbolic), or if something else is at play.
Just to clarify, I can do the same thing without embedding sources. First add the Sentry .NET SDK (or MAUI SDK), then build in release mode, and then use sentry-cli dif upload --include-sources (or integrated <SentryUploadSources>true</SentryUploadSources>), then do something that sends an event to Sentry.
In either case, whether uploading sources separately or embedded, source context does appear for plain .NET Android apps, but not for MAUI .NET Android apps.
OK, so after also printing non-embedded sources, the dump matches dotpeek output:
c:\dev\sentry-cli\\target\release\sentry-cli.exe dif dump-sources .\MauiApp1.pdb
portablepdb 879cb913-665a-4785-8aea-8cb0d99d1e14-ad967672 references sources:
/Users/matt/temp/MauiApp1/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/Resources_Styles_Colors.xaml.sg.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/Resources_Styles_Styles.xaml.sg.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/App.xaml.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/App.xaml.sg.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/AppShell.xaml.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/AppShell.xaml.sg.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/MainPage.xaml.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/MainPage.xaml.sg.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/MauiProgram.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/Platforms/Android/MainApplication.cs
Not embedded nor available locally at the referenced path.
/Users/matt/temp/MauiApp1/obj/Release/net7.0-android/Resource.designer.cs
Not embedded nor available locally at the referenced path.
Does that at all explain why uploading sources with SentryUploadSources (i.e. sentry-cli dif upload --include-sources) would not work for a MAUI Android app?
Does that at all explain why uploading sources with SentryUploadSources (i.e. sentry-cli dif upload --include-sources) would not work for a MAUI Android app?
Not really. Maybe that's the same issue as the iOS one?
I've just tried reproducing locally with the given steps to create a new maui app, build for android release, upload with "--include-sources" and everything works fine:
I did use a latest local build of sentry-cli though, not sure it makes a difference...
OK, it does because the latest released version from getsentry/sentry-cli fails with error: malformed debug info file & caused by: invalid custom debug information table item tag 0 - so it doesn't have the recent fix added to skip these.
When I first opened this issue, I was using Sentry CLI 2.12.0. It still reproduces with 2.13.0. However, if I build Sentry Cli from main, it appears to be fixed. Looks like Sentry CLI recently had Symbolic bumped to 12, but hasn't been released yet. So I expect this should be resolved with the next release of Sentry CLI (2.13.1 or 2.14.0).
I'll leave this open to validate after we can update. Thanks!
Activity
mattjohnsonpint commentedon Feb 11, 2023
Just to clarify, I can do the same thing without embedding sources. First add the Sentry .NET SDK (or MAUI SDK), then build in release mode, and then use
sentry-cli dif upload --include-sources(or integrated<SentryUploadSources>true</SentryUploadSources>), then do something that sends an event to Sentry.In either case, whether uploading sources separately or embedded, source context does appear for plain .NET Android apps, but not for MAUI .NET Android apps.
No difference in behavior between .NET 6 and 7.
mattjohnsonpint commentedon Feb 11, 2023
@Swatinem @vaind - have a look? Here are the two project's symbol files. Both should have embedded sources. Can you see if they actually do please?
Symbols.zip
Thanks.
[-]Missing source context with MAUI Android apps[/-][+]Missing source context with MAUI apps[/+]mattjohnsonpint commentedon Feb 13, 2023
Testing a bit more, and something similar (but not quite identical) is happening for iOS.
A MAUI iOS app gets source context only when
EmbedAllSourcesistrue. Using sentry-cli, orSentryUploadSourcesdoes not appear to work.However, a non-MAUI iOS app (
dotnet new ios) does get source context whenSentryUploadSourceswas used.Something about MAUI specifically is interfering with source context. Not sure what.
mattjohnsonpint commentedon Feb 13, 2023
Also note that sometimes the debug info will show erroneously in Sentry as "Deleted"
But I don't believe this is related, because when sources are uploaded separately the source bundle is labeled "Ok"
Also the debug file isn't really deleted, but somehow the status is incorrectly reported. More on this in getsentry/sentry#44485
vaind commentedon Feb 15, 2023
With the new util to print sources in a PDB, we can see the MAUI one doesn't embed the sources.
vaind commentedon Feb 15, 2023
On the other hand, dotpeek shows them... needs more investigation.
vaind commentedon Feb 15, 2023
OK, so after also printing non-embedded sources, the dump matches dotpeek output:
mattjohnsonpint commentedon Feb 15, 2023
Does that at all explain why uploading sources with
SentryUploadSources(i.e.sentry-cli dif upload --include-sources) would not work for a MAUI Android app?vaind commentedon Feb 15, 2023
Not really. Maybe that's the same issue as the iOS one?
mattjohnsonpint commentedon Feb 15, 2023
I don't have symbolication problems on Android, just source context. But perhaps related to trimming. I'm not sure.
vaind commentedon Feb 15, 2023
I've just tried reproducing locally with the given steps to create a new maui app, build for android release, upload with "--include-sources" and everything works fine:
https://sentry-sdks.sentry.io/issues/3893145000/events/940cd008a2f6425b8c0689ec83c5bd40/?project=5428537
I did use a latest local build of sentry-cli though, not sure it makes a difference...
vaind commentedon Feb 15, 2023
OK, it does because the latest released version from getsentry/sentry-cli fails with
error: malformed debug info file&caused by: invalid custom debug information table item tag 0- so it doesn't have the recent fix added to skip these.What version have you tried uploading with @mattjohnsonpint?
vaind commentedon Feb 15, 2023
As for the embedded sources in MAUI PDB - this is a bug in symbolic, see getsentry/symbolic#759
bruno-garcia commentedon Feb 27, 2023
symbolic released with a fix is: 12.0.0
It's already in
mainon symbolicator: https://github.com/getsentry/symbolicator/blob/ca39b31dff7f59952b253ef17e9f67ad5de2fa97/crates/symbolicator/Cargo.toml#L23added through: getsentry/symbolicator#1056
mattjohnsonpint commentedon Feb 28, 2023
When I first opened this issue, I was using Sentry CLI 2.12.0. It still reproduces with 2.13.0. However, if I build Sentry Cli from main, it appears to be fixed. Looks like Sentry CLI recently had Symbolic bumped to 12, but hasn't been released yet. So I expect this should be resolved with the next release of Sentry CLI (2.13.1 or 2.14.0).
I'll leave this open to validate after we can update. Thanks!
mattjohnsonpint commentedon Mar 19, 2023
This is fixed as of Sentry .NET 3.29.0.
Example with source context from MAUI app built in Release mode: