maui: cannot debug or show output of Release built application on Android

Description

Release build for Android takes 2.5 minutes to build and run for Android on i7 6700 HQ and fast SSD for the template MAUI Blazor project. Moreover, this message started showing. Reinstalling VS did not help (completely, all versions including VS Installer), resetting settings did not help. Shows also for new apps created from template.

Start debugging Android application ...
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.mauiapp3/crc64e73e5e987e2fb5cd.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.mauiapp3/crc64e73e5e987e2fb5cd.MainActivity }

Android application is running (debug is disabled in android project properties).

Yesterday with RC 1, I have been able to show output of 1 Release run of my Blazor MAUI app which showed this error which also probably causes my MAUI Blazor application to crash on Release build. This Error type 3 crash on startup can be solved using <PublishTrimmed>False</PublishTrimmed>.

image

Since then, all the time: Android application is running (debug is disabled in android project properties). for all projects. There is no such setting to Enable/Disable debugging in Android project properties. And thus I cannot see any output and cannot watch Trace.WriteLine output or watch what caused application crash when in Release mode. And adding <DebugSymbols>True</DebugSymbols> to .csproj does not solve the issue.

Default settings for all my projects look like this: image

I need to diagnose the error to report it. Please help me what to do to get debugging back for Release build.

Steps to Reproduce

create new maui app press run on android in Release mode image

Version with bug

Release Candidate 2 (current)

Last version that worked well

Release Candidate 1

Affected platforms

Android

Affected platform versions

Android 11 (API 30)

Did you find any workaround?

no

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

Yes, I don’t see log messages in the minimized one like:

05-06 21:49:12.737 12213 12213 D Mono    : ...
05-06 21:49:12.737 12213 12213 D monodroid-assembly: ...
05-06 21:49:12.737 12213 12213 I monodroid-timing: ...

Android logs random stuff all the time, so that is what is in there now.

This looks like it might be duplicate of: https://github.com/dotnet/runtime/issues/67402

The fix for this will be shipping soon, let us check back with you when it’s available.

@janseris it seems like you might reporting several different problems at once. Should we investigate your crash and why you need PublishTrimmed=false?

If the app is crashing can you enable more logging with:

adb shell setprop debug.mono.log default,timing,assembly,mono_log_level=debug,mono_log_mask=all

Then save the log with adb logcat -d > log.txt:

https://docs.microsoft.com/en-us/xamarin/android/deploy-test/debugging/android-debug-log?tabs=windows#accessing-from-the-command-line

@XamlTest which problem were you able to repro with 17.3.0 Preview 1.0 [32414.199.main]? Can you give some details?