Warn when Android full trimming strips the debug IDs needed for symbolication
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- android, csharp
- Domain
- build-system, documentation, mobile
Research direction
Read Sentry.targets and the linked Microsoft.Android.Sdk.TypeMap.LlvmIr.targets _PrepareLinking entry point, then run the net11.0-android37.0 arm64 full-trim scenario described in the issue. Done means an informational, suppressible warning appears only for full trimming with symbols removed, and docs/platforms/dotnet/common/troubleshooting.mdx documents the cause, workaround, and caveats.
Written by the indexing model from the issue text.
Description
Problem
Android apps that trim their own assemblies (TrimMode=full, e.g. AndroidLinkMode=Full) get no symbolication for managed stack traces in Release builds, and nothing tells the user why.
In Release the Android SDK forces TrimmerRemoveSymbols=true in its _PrepareLinking target unless AndroidIncludeDebugSymbols=true (Microsoft.Android.Sdk.TypeMap.LlvmIr.targets; the same override has existed since .NET 6). With full trimming, ILLink rewrites the app's assemblies and drops their debug directory, so:
obj/.../linked/<App>.dllhas an all-zero debug ID and nolinked/*.pdbis produced- at runtime the SDK logs
Skipping debug image for module '<App>.dll' because the Debug ID couldn't be determined - events have no
debug_metaimage for the app assembly, so frames can't be symbolicated even though the build uploaded PDBs
With the default TrimMode=partial, app assemblies are copied through untouched, keep their debug IDs, and symbolication works.
Found while verifying .NET 11 assembly store support end to end (#5577) with Sentry.Samples.Android, which sets AndroidLinkMode=full.
Workaround (verified)
Setting TrimmerRemoveSymbols=false as a normal csproj property (or -p:) does not work — _PrepareLinking overrides it. It has to be set after that target runs:
<Target Name="KeepTrimmerSymbols" AfterTargets="_PrepareLinking">
<PropertyGroup>
<TrimmerRemoveSymbols>false</TrimmerRemoveSymbols>
</PropertyGroup>
</Target>
With that, and AndroidLinkMode=full unchanged, on net11.0-android37.0 / arm64: ILLink emits linked/*.pdb, the trimmed DLL and its PDB share a real debug ID, Sentry.targets already uploads linked/*.pdb, and the captured event carries the pe_dotnet debug image with a symbolicatable frame.
Caveats: _PrepareLinking is a private Android SDK target, so this could break in a future workload. AndroidIncludeDebugSymbols=true also keeps symbols but changes other Release behaviour (type map kind, CoreCLR native library exclusions, Mono debugger component), so it isn't a good general recommendation. The cost of keeping symbols in the APK is negligible — PDBs aren't packaged, only each assembly's debug directory is retained.
Proposal
We shouldn't flip the property for users (they may want symbols removed), but we should make the consequence visible:
- Build warning from
Sentry.targetsfor Android apps when app assemblies are trimmed (TrimMode=full) andTrimmerRemoveSymbolsistrueat link time, explaining that managed stack traces won't symbolicate and pointing to the docs. It can't distinguish an intentionaltruefrom the Android SDK's forced value, so it should be informational and suppressible viaNoWarn. Don't warn forTrimMode=partial. - Troubleshooting docs: add an Android section to the .NET troubleshooting page (
docs/platforms/dotnet/common/troubleshooting.mdxin sentry-docs), alongside the existing "Stack traces are not symbolicated on iOS, macOS and Mac Catalyst" section, covering the cause, the workaround above and its caveats. The "Missing or Unhelpful Stack Traces in AOT Compiled Apps" section is about the stack trace factory, which is a different cause.
- Dominant language
- C#
- Stars
- 775
- Forks
- 262
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 118
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS samplePossibly taken A pull request linked to this issue is open or already merged. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6071 · 1 comment ·
Maintainers usually reply within 1 day
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Possibly taken @pcbeingused33 claimed this today. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6039 · 3 comments ·
Maintainers usually reply within 1 day
-
.NET Platform: Android Task
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
getsentry/sentry-dotnet#6020 · 3 comments ·
Maintainers usually reply within 1 day
-
Move the Blazor WebAssembly sample off the deprecated DevServerPossibly taken A pull request linked to this issue is open or already merged. Open.NET Framework: Blazor
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
getsentry/sentry-dotnet#5906 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Docs MSBuild Needs Docs Update
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getsentry/sentry-dotnet#5691 · 1 comment ·
Maintainers usually reply within 1 day
All issues in getsentry/sentry-dotnet
Similar issues
-
In-car displays show 0 km/h and P while the AV drivesPossibly taken @bazilinskyy claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bazilinskyy/coupled-sim#366 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BaryoDev/umbraco-pwa#196 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/fluentui-blazor#5688 ·
Maintainers usually reply within 1 day
-
bug flaky lsp-transport small
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day