Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App stops/closes while on splash screen when debugging #9511

Open
trampster opened this issue Nov 13, 2024 · 2 comments
Open

App stops/closes while on splash screen when debugging #9511

trampster opened this issue Nov 13, 2024 · 2 comments
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`.

Comments

@trampster
Copy link

trampster commented Nov 13, 2024

Android framework version

net8.0-android

Affected platform version

vscode 1.94.2, .net80, .NET MAUI vscode extenstion v1.4.36, c# Dev Kig v1.13.9, Ubuntu 22.04.5 LTS

Description

When trying to debug on most android phones (except for a google pixel 4a which always works) from VSCode on Linux then the app shows the splash screen briefly (1 second) and then stops. The debugger is no longer attached. And there are no logs to indicate why.

If you then try and manually launch the app it gets stuck indefinitely on the splash screen, if you then kill the app and relaunch then it works.

Launching the app from the command line also works using:

dotnet build Pttox.Forms.csproj -f net8.0-android -t:Install -t:Run

We have seen this on a varity of Android phones including a bunch of different Samsung devices and Sonim and RugGear devices.

Steps to Reproduce

  1. Load a .NET Maui project that targets Android
  2. Select a real device to deploy to Ctrl-Shift-P -> .NET MAUI: Pick Android Device
  3. Press F5 to start debugging
    -> Expected: the APP to launch and be debugging
    -> Actual: The splash screen shows briefly and then the app is gone, and the debugger isn't attached.

Did you find any workaround?

Various devs here report that if you keep trying it will work roughly 1 in 10 attempts. It also always works on the Google Pixel 4a

Relevant log output

Output in Terminal that is taken over by VSCode when you press F5 (note this looks exactly the same as on the Pixel 4a that works)

 *  Executing task: dotnet build -t:Run -p:Configuration=Debug -f net8.0-android -p:AdbTarget=-s%20725EU21J17D00502 -p:AndroidAttachDebugger=true -p:AndroidSdbTargetPort=37133 -p:AndroidSdbHostPort=37133 -p:CustomAfterMicrosoftCSharpTargets="/home/hughesd/.vscode/extensions/ms-dotnettools.dotnet-maui-1.4.36-linux-x64/dist/resources/Custom.After.Microsoft.CSharp.targets" -p:MauiVSCodeBuildOutputFile="/tmp/dotnet-maui/maui-vsc-579cf243-174c-4fc5-8069-55ee23b4ebda.json" -p:AndroidSdkDirectory="/home/hughesd/android-sdk" -p:JavaSdkDirectory="/usr/lib/jvm/java-17-openjdk-amd64" /home/hughesd/work/hydra-src/apps/Xamarin-PTToX/src/Pttox.Forms/Pttox.Forms.csproj 

  Determining projects to restore...
  All projects are up-to-date for restore.
  Tait.Threading -> /home/hughesd/work/hydra-src/libs/Tait.Threading/src/bin/Debug/netstandard2.1/Tait.Threading.dll
  Pttox.Core -> /home/hughesd/work/hydra-src/apps/Xamarin-PTToX/src/Pttox.Core/bin/Debug/net8.0-android/Pttox.Core.dll
  Pttox.Forms -> /home/hughesd/work/hydra-src/apps/Xamarin-PTToX/src/Pttox.Forms/bin/Debug/net8.0-android/Pttox.Forms.dll
  Tait.Threading -> /home/hughesd/work/hydra-src/libs/Tait.Threading/src/bin/Debug/netstandard2.1/Tait.Threading.dll
  Pttox.Core -> /home/hughesd/work/hydra-src/apps/Xamarin-PTToX/src/Pttox.Core/bin/Debug/net8.0-android/Pttox.Core.dll
  37133
    Starting Debugger on 127.0.0.1:37133
  Start sdb then run the following command
    connect 127.0.0.1 37133
      

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.46
 *  Terminal will be reused by tasks, press any key to close it.

Debug Console in vscode:
This shows that the app exited but contains no other logs at all from the app.

------------------------------------------------------------------------------
You may only use the Microsoft Visual Studio .NET/C/C++ Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you
develop and test your applications.
------------------------------------------------------------------------------
The program 'Pttox.Forms.dll' has exited with code 0 (0x0).

I have attached logcat output from the run. It also has no actual log output from the app itself but does show ActivityTaskManager and ActivityManager logs for launching the app (search for com.taitradio.unified.pttox)

adb.log

@trampster trampster added Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned. labels Nov 13, 2024
@trampster trampster changed the title App stops while on splash screen when debugging App stops/closes while on splash screen when debugging Nov 13, 2024
@jonpryor
Copy link
Member

Please try running:

adb shell setprop debug.mono.log all

and try debugging again. That should provide some additional information, though I don't know if that'll be enough to understand why things are failing…

@trampster
Copy link
Author

@jonpryor Setting adb shell setprop debug.mono.log all makes it work. But it takes several minutes to clear the splash screen. Could it be a timing issue.

@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App Runtime Issues in `libmonodroid.so`.
Projects
None yet
Development

No branches or pull requests

4 participants