Skip to content

[Migration] DOTNET_DiagnosticPorts in Environment.txt causes silent app freeze when upgrading from .NET 10 (Mono) to .NET 11 (CoreCLR) #12235

Description

@janne-hmp

Android framework version

net11.0-android (Preview)

Affected platform version

Android 16

Description

As per the post by @davidortinau last week, we have been testing how .NET 11 Preview 6 compares with .NET 10. We noticed that when upgrading a .NET MAUI Android application from .NET 10 (Mono) to .NET 11 (CoreCLR), the application silently freezes at startup and then exits with code 0 if the project's Platforms/Android/Environment.txt contains:

DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend,connect

This setting was commonly used (and sometimes recommended) for Mono debugging on Android. On the Mono runtime, the Xamarin debugger tooling handled this diagnostic port connection seamlessly. However, on CoreCLR in .NET 11, the runtime interprets this literally; it suspends at startup and waits indefinitely for a diagnostic client to send a ResumeStartup command via IPC. Since the VS debugger doesn't connect using this mechanism on CoreCLR, the app hangs and eventually exits silently.

Why This Is Critical

  • Silent failure: The app exits with code 0 and no crash, exception, or error message. There is no indication of what went wrong.
  • Difficult to diagnose: The only clue is a single line in logcat: The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port. which is easily missed or misinterpreted.
  • Common configuration: Many existing .NET Android projects have this line in Environment.txt from Mono/Xamarin-era setup guides.
  • Migration trap: Developers upgrading to .NET 11 will hit this immediately with no obvious path to resolution.

Expected Behavior

One or more of the following:

  1. A build warning when targeting .NET 11 CoreCLR and Environment.txt contains DOTNET_DiagnosticPorts with suspend alerting the developer that this is incompatible with CoreCLR on Android.
  2. A migration guide entry documenting that this setting must be removed when upgrading from Mono to CoreCLR.
  3. The runtime or Android tooling ignoring or overriding the suspend mode when launched from the IDE debugger.

Actual Behavior

The app silently hangs at startup and exits with code 0. No error, no crash, no warning.

Environment

  • .NET SDK: 11.0.100-preview.6 (or later)
  • Previous SDK: .NET 10 (Mono runtime)
  • Platform: Android (arm64)
  • IDE: Visual Studio 2026

Steps to Reproduce

  1. Take any .NET MAUI Android project that was previously targeting net10.0-android.
  2. Ensure Platforms/Android/Environment.txt contains:
    DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend,connect
    
  3. Change TargetFrameworks to net11.0-android.
  4. Build and deploy to an Android device.
  5. The app will launch, appear to do nothing, and then exit silently.

Did you find any workaround?

Remove the DOTNET_DiagnosticPorts line from Environment.txt:

-DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend,connect
 MONO_GC_PARAMS=nursery-size=128m

Relevant log output

### Logcat Output


I/DOTNET  (27334): The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port.
I/DOTNET  (27334): DOTNET_DiagnosticPorts="127.0.0.1:9000,suspend,connect"
I/DOTNET  (27334): DOTNET_DefaultDiagnosticPortSuspend=0
The program 'MyApp.dll' has exited with code 0 (0x0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App RuntimeIssues in `libmonodroid.so`.need-attentionA xamarin-android contributor needs to review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions