Skip to content

fix(android): symbolicate managed exceptions from NativeAOT apps - #5916

Open
charlesroddie wants to merge 2 commits into
getsentry:mainfrom
charlesroddie:fix/android-nativeaot-debug-images
Open

charlesroddie wants to merge 2 commits into
getsentry:mainfrom
charlesroddie:fix/android-nativeaot-debug-images

Conversation

@charlesroddie

Copy link
Copy Markdown

Problem

Managed exceptions from NativeAOT apps on Android can't be symbolicated. DebugStackTrace.TryCreateNativeAOTFrame left _nativeDebugImages empty on Android, so frames carry image_addr and instruction_addr but the event has no debug_meta. Sentry marks every frame unknown_image, even when the matching debug file is uploaded.

Observed with Sentry .NET 6.12.1, .NET 11, NativeAOT, arm64 Android 10: debug_meta is null on the managed event, while the same app's native crash event (from sentry-native) lists the app's .so with its GNU build-id as code_id and debug_status: found. Resolving the managed frames' offsets against the uploaded debug file locally gives correct functions with file and line.

Fix

On Android, fill _nativeDebugImages from the module list sentry-native already builds, via the bound io.sentry.ndk.NativeModuleListLoader. Entries are keyed by image address and used exactly like the Cocoa and Sentry.Native paths, and carry type (elf), image_addr, image_size, code_id, debug_id, code_file and debug_file as sentry-native reports them.

  • The list is cached once non-empty, as in Sentry.Native.C.LoadDebugImages (the NDK caches its module list too).
  • Nothing is loaded when options.Native.EnableNdk is false, since the NDK libraries aren't loaded then.

Testing

  • NativeDebugImagesTests: conversion from the NDK's DebugImage (Android only).
  • DebugStackTraceTests: a NativeAOT frame inside a loaded native image adds that image to the event; none is added with the NDK disabled (Android only).

The Android targets of Sentry and Sentry.Tests build, and DebugStackTraceTests pass on net10.0. The Android-only tests have not been run: I had no emulator available, so they rely on the CI device tests.

🤖 Generated with Claude Code

charlesroddie and others added 2 commits November 11, 2026 09:42
Managed exceptions from NativeAOT apps on Android carried image_addr and
instruction_addr but no debug_meta, so Sentry could not symbolicate them.
Load the module list sentry-native already builds, through the bound NDK
NativeModuleListLoader, keyed by image address like the Cocoa path.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Also skip modules whose address can't be parsed instead of discarding
the whole list, and call the static module list loader directly.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@charlesroddie
charlesroddie marked this pull request as ready for review November 11, 2026 10:13
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant