Skip to content

Partial source context in Release with multi-project MAUI apps #4278

Open
@NathanielJS1541

Description

@NathanielJS1541

Package

Sentry.Maui

.NET Flavor

MAUI

.NET Version

9.0.301

OS

Android

OS Version

Android API 34/35.

Development Environment

Visual Studio v17.x

SDK Version

6.10.0

Self-Hosted Sentry Version

No response

Workload Versions

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
android                    35.0.61/9.0.100        VS 17.14.36203.30
ios                        18.4.9288/9.0.100      VS 17.14.36203.30
maccatalyst                18.4.9288/9.0.100      VS 17.14.36203.30
maui-windows               9.0.51/9.0.100         VS 17.14.36203.30
wasm-tools                 9.0.6/9.0.100          VS 17.14.36203.30

Use `dotnet workload search` to find additional workloads to install.

UseSentry or SentrySdk.Init call

            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp<App>()
                .UseSentry(options => {
                    options.Dsn = "";

                    // Set SDK to debug mode, as this is a repro app.
                    options.Debug = true;

                    // Application release and distribution.
                    options.Release = $"maui-sentry-test@{AppInfo.VersionString}";
                    options.Distribution = AppInfo.BuildString;

                    // Set the environment based on build configuration.
#if DEBUG
                    options.Environment = "Development";
#else
                    options.Environment = "Production";
#endif
                })

Steps to Reproduce

  1. Clone my repro project.
  2. Follow the README.md to configure the Sentry application and organisation slugs, and DSN.
  3. Build the app in Debug mode, and deploy to a device (i.e. Android).
  4. Launch the app and click the CommonService Exception button.
  5. Check your Sentry issues for the report, observe the behaviour from the "Expected" section.
  6. Build the app in Release mode, and deploy to a device.
  7. Launch the app and click the CommonService Exception button.
  8. Check your Sentry issues for the report, observe the behaviour from the "Actual Result" section.

This issue seems to be exhibited specigically when an exception occurs in a project separate to the main MAUI app, and the build is trimmed / optimised.

Expected Result

The stack trace will show line numbers and source context for all managed source:

Image

Actual Result

In release mode, the stack trace only shows line numbers and source context for code within the "App" project:

Image

I will note that I'm also seeing similar issues on iOS, but currently I can only deploy the test app to the simulator and it doesn't seem to be an issue there. Windows doesn't seem to show the same issue.

Metadata

Metadata

Labels

.NETPull requests that update .net codeBugSomething isn't working

Type

No type

Projects

Status

No status

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions