dotnet / dotnet/maui

Publishing deletes resources, for example in the case of TaskCanceledException message!

Open
#33,837 0 comments 0 reactions 0 assignees View on GitHub
t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Dotnet publish release delete system resources from Android apk and aab!
Publish with dotnet tool version 10.0.102 under Linux.

### Steps to Reproduce

1. create standard Maui app from template
2. Insert this on Click event
```
private void OnCounterClicked(object? sender, EventArgs e)
{

try
{
throw new TaskCanceledException();
}
catch (Exception exp)
{
CounterBtn.Text = exp.Message;
}
SemanticScreenReader.Announce(CounterBtn.Text);
}
```
3. Start under debug -> Message from resource displayed, all looks good
4. Publish with
`dotnet publish Maui10Test.csproj -c Release /t:Rebuild -p:AndroidPackageFormats=apk`
5. Install on Android emulator with `adb install com.companyname.maui10test-Signed.apk`
6. Click on Button the Text "TaskCanceledException_ctor_DefaultMessage" displayed!

### Link to public reproduction project repository

_No response_

### Version with bug

10.0.10

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

Android 7 till Android 16

### Did you find any workaround?

No

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the standard MAUI app and OnCounterClicked handler described in the issue, then reproduce the Android Release publish using Maui10Test.csproj and the provided dotnet publish command. Compare Debug and published APK behavior for TaskCanceledException.Message on the listed Android versions. Done means the published app displays the expected exception message without losing the relevant resource.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.