Skip to content

[xabt] Default Java (JDWP) debugging to disabled - #12625

Open
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-disable-java-debugging-default
Open

[xabt] Default Java (JDWP) debugging to disabled#12625
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-disable-java-debugging-default

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Sep 1, 2026

Copy link
Copy Markdown
Member

Why

This is a smaller alternative to #12589 for the pre-runtime Waiting For Debugger race seen in the VS Code MAUI F5 path. The extension launches Android apps through dotnet build -t:Run with AndroidAttachDebugger=true. Today, _Run defaults Java debugging on, which adds am start -D, opens a temporary JDWP connection through ConnectJdwpAsync(), and relies on the Android.Debug.waitForDebugger() gate. That JDWP startup sequence can race before the managed runtime is ready.

VS Code only needs managed debugging for this scenario. Defaulting $(_AndroidAllowJavaDebugging) to False bypasses the JDWP connection and wait gate entirely, while preserving $(_AndroidAllowJavaDebugging)=True as an explicit opt-in.

The JDWP path appears to have originated as a workaround for Windows Subsystem for Android, which is now retired. Rather than add more JDWP readiness protocol handling to .NET 11, this keeps the .NET 11 change minimal ahead of removing the obsolete path in .NET 12.

This addresses the pre-runtime wait race only; it does not address the separate post-runtime RemoteCoreCLR EventStream race.

Testing

  • validated Xamarin.Android.Common.Debugging.targets as XML

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 1, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR changes the default behavior of the debugging run targets so Java debugging is disabled by default unless explicitly enabled via $(_AndroidAllowJavaDebugging).

Changes:

  • Set $(_AndroidAllowJavaDebugging) default to False when it is not explicitly provided.
  • Keep explicit property overrides working by only applying the default when the property is empty.
File summaries
File Description
src/Xamarin.Android.Build.Debugging.Tasks/Xamarin.Android.Common.Debugging.targets Changes the default value of $(_AndroidAllowJavaDebugging) in the _Run target property initialization.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

@jonathanpeppers jonathanpeppers changed the title Default Java debugging to disabled [xabt] Default Java (JDWP) debugging to disabled Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants