Skip to content

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

Open

Description

@trampster

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

Activity

  1. added
    Area: App Runtime
    needs-triage
    on Nov 13, 2024
  2. changed the title [-]App stops while on splash screen when debugging[/-] [+]App stops/closes while on splash screen when debugging[/+] on Nov 13, 2024
  3. jonpryor commented on Nov 14, 2024

    @jonpryor
    Contributor

    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…

  4. trampster commented on Nov 14, 2024

    @trampster
    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.

  5. removed
    needs-triage
    on Nov 20, 2024
  6. Sascha-L commented on Mar 21, 2025

    @Sascha-L

    Same here. .NET 9 MAUI App (New Project), Samsung Galaxy A13 with Android 14. Until a few months it always worked. Now debugging is not working anymore. App is deployed successfully, App can be started by my self with any errors, but if I run with debugger only the blue .NET splashscreen is shown for max. 1s and then the app exited without any errors.

  7. spouliot commented on May 14, 2025

    @spouliot

    This started happening to me this afternoon. After setting adb shell setprop debug.mono.log all this is what is shown in code's debug console:

    ------------------------------------------------------------------------------
    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 'hrmd.dll' has exited with code 0 (0x0).
    [ompanyname.hrmd] Late-enabling -Xcheck:jni
    [CompatibilityChangeReporter] Compat change id reported: 171979766; UID 10180; state: ENABLED
    [System.out] Sending WAIT chunk
    [System.out] Debugger has connected
    [System.out] waiting for debugger to settle...
    [System.out] waiting for debugger to settle...
    [System.out] waiting for debugger to settle...
    [System.out] waiting for debugger to settle...
    [System.out] waiting for debugger to settle...
    [System.out] waiting for debugger to settle...
    [System.out] debugger has settled (1369)
    [nativeloader] Configuring classloader-namespace for other apk /system_ext/framework/androidx.window.extensions.jar. target_sdk_version=35, uses_libraries=ALL, library_path=/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64:/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.companyname.hrmd
    [nativeloader] Configuring classloader-namespace for other apk /system_ext/framework/androidx.window.sidecar.jar. target_sdk_version=35, uses_libraries=ALL, library_path=/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64:/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.companyname.hrmd
    [ziparchive] Unable to open '/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.dm': No such file or directory
    [ziparchive] Unable to open '/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.dm': No such file or directory
    [nativeloader] Configuring classloader-namespace for other apk /data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64:/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.companyname.hrmd
    [GraphicsEnvironment] ANGLE Developer option for 'com.companyname.hrmd' set to: 'default'
    [GraphicsEnvironment] ANGLE GameManagerService for com.companyname.hrmd: false
    [GraphicsEnvironment] Neither updatable production driver nor prerelease driver is supported.
    [NetworkSecurityConfig] No Network Security Config specified, using platform default
    [NetworkSecurityConfig] No Network Security Config specified, using platform default
    [DOTNET] AndroidCryptoNative_InitLibraryOnLoad: jint AndroidCryptoNative_InitLibraryOnLoad(JavaVM *, void *) in /__w/1/s/src/native/libs/System.Security.Cryptography.Native.Android/pal_jni.c
    [DOTNET] GetOptionalClassGRef: optional class com/android/org/conscrypt/OpenSSLEngineImpl was not found
    [monodroid-timing] [0/4] XATiming: init time; elapsed: 0:0::2541
    [monodroid-assembly] Checking if libmonodroid was unpacked to /data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64/libmonodroid.so
    [monodroid-assembly] Native libs extracted to /data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64, assuming application/android:extractNativeLibs == true
    [monodroid] Creating XDG directory: /data/user/0/com.companyname.hrmd/files/.local/share
    [monodroid] Creating XDG directory: /data/user/0/com.companyname.hrmd/files/.config
    [monodroid] Failed to create directory '/data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a'. File exists
    [monodroid] Creating public update directory: `/data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a`
    [monodroid] Mono AOT mode: interp
    [monodroid] Setting environment variable 'MONO_GC_PARAMS' to 'major=marksweep-conc'
    [monodroid] Setting environment variable 'MONO_LOG_LEVEL' to 'info'
    [monodroid] Setting environment variable 'XA_HTTP_CLIENT_HANDLER_TYPE' to 'Xamarin.Android.Net.AndroidMessageHandler'
    [monodroid] Loading environment from  override directories.
    [monodroid] /data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a/environment
    [monodroid] Loading /data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a/environment
    [monodroid] Setting environment variable from the override file /data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a/environment: 'DOTNET_MODIFIABLE_ASSEMBLIES' = 'Debug'
    [monodroid] Setting environment variable from the override file /data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a/environment: '__XA_PACKAGE_NAMING_POLICY__' = 'LowercaseCrc64'
    [monodroid] Setting environment variable from the override file /data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a/environment: 'mono.enable_assembly_preload' = '0'
    [monodroid] Setting up for DSO lookup in app data directories
    [monodroid-assembly] Added filesystem DSO lookup location: /data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64
    [monodroid] Failed to create directory '/data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a'. File exists
    [monodroid] Failed to create directory '/data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a'. File exists
    [monodroid] Env variable '__UNO_SUPPORT_DEBUG_HOT_RELOAD__' set to 'true'.
    [ompanyname.hrmd] Attempt to remove non-JNI local reference, dumping thread
    [monodroid] Using runtime path: /data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64
    [monodroid] Connection options: 'port=10000'
    [monodroid] XS port = 10000
    [monodroid-timing] [0/3] Debug::start_debugging_and_profiling: end; elapsed: 2:1::48209
    [monodroid] Probing for Mono AOT mode
    [monodroid] Enabling Mono Interpreter
    [monodroid] Probing if we should use LLVM
    [monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:57676,server=y,embedding=1,timeout=30000
    [monodroid-debug] soft breakpoints enabled by default (debug.mono.soft_breakpoints property not defined)
    [monodroid] Listened2 for connections from XS for 2 seconds, nobody connected.
    [monodroid-gc] environment supports jni NewWeakGlobalRef
    [monodroid-timing] [0/7] Runtime.init: Mono runtime init; elapsed: 0:2::402667
    [monodroid-assembly] Registering assemblies from the filesystem
    [monodroid-assembly] Looking for assemblies in '/data/app/~~ZvTBUl0VFzG7CQXSPpMvYQ==/com.companyname.hrmd-5VrYkX8tNOyNrkMzuZ-oDA==/lib/arm64'
    [monodroid-assembly] Mapping runtime config blob from 'libarc.bin.so'
    [monodroid-assembly]                        mmap_start: 0x7f75f93000  mmap_end: 0x7f75fa4a60  mmap_len:        18072  file_start: 0x7f75f93000  file_end: 0x7f75fa4a60  file_len:        18072      apk descriptor: 75  file: libarc.bin.so
    [monodroid-assembly] Runtime config: payload pointer 0x7f75f97000 ; size 983
    [monodroid-assembly] Looking for assemblies in '/data/user/0/com.companyname.hrmd/files/.__override__/arm64-v8a'
    [monodroid-assembly] Found 423 assemblies on the filesystem
    [monodroid-timing] [0/9] Register runtimeconfig binary blob; elapsed: 0:0::333
    [monodroid-assembly] monodroid_dlopen: hash for name 'libmono-component-diagnostics_tracing.so' is 0x8ad0d04070d5c449
    [monodroid-assembly] Looking for hash 0x70d5c449 in AOT cache
    [monodroid-assembly] Looking for hash 0x70d5c449 in DSO cache
    [monodroid-assembly] monodroid_dlopen: hash match not found, DSO name is '<unknown>'
    [monodroid-assembly] Mono 'Diagnostics Tracing' component requested but not packaged, ignoring
    

    Let me know if I can provide anything else (as long as I can dupe this).

  8. removed their assignment
    on Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: App Runtime

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions