dotnet / dotnet/android

Make it possible to build Release config apk which contains pdb symbols

Open
#8,048 4 comments 1 reaction 2 assignees Claimed by @jonathanpeppers View on GitHub
Area: App+Library Build
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

### Android application type

.NET Android (net7.0-android, etc.)

### Affected platform version

VS 17.6

### Description

Make it possible to build a project in Release config (`dotnet build -c Release`) and have the resulting app contain debug symbols `.pdb` files.

Note: Assembly Stores (c92702619f5fabcff0ed88e09160baf9edd70f41) support storing `.pdb` information.

The intention is to make it *easily possible* for unhandled exceptions to contain filename + line number information without using other tools. (`mono-symbolicate` doesn't appear to have made the .NET Android transition yet…)

### Steps to Reproduce

"Repro steps":

1. Create a new Android app:

dotnet new android -n android_hw

2. Update `MainActivity.OnCreate()` to throw an exception:

```csharp
partial class MainActivity : Activity {
protected override void OnCreate(Bundle? b) => throw new Exception ("Where am I?");
}
```

3. Build and run the app.

```sh
dotnet build -c Release
dotnet build -c Release -t:Install # or adb install …
dotnet build -c Release -t:_Run
```

4. Look at `adb logcat` output.

Desired behavior: filename and line number information in `adb logcat` output:

```
I MonoDroid: android.runtime.JavaProxyThrowable: System.Exception: Where am I?
I MonoDroid: at android_hw.MainActivity.OnCreate(Bundle savedInstanceState) in …/android-hw/MainActivity.cs:line 12
```

Actual behavior: No filename and line number information is in `adb logcat`

### Did you find any workaround?

Yes: setting `$(DebugType)`=embedded along with setting the `debug.mono.debug` system property to `true`/`1`/etc. allows filename and line number information to appear in `adb logcat`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.