Repository navigation
[Tools] Wait for Android JDWP application readiness - #12589
Closed
davidnguyen-tech wants to merge 2 commits into
Closed
davidnguyen-tech wants to merge 2 commits into
davidnguyen-tech wants to merge 2 commits into
Conversation
Use DDM boot-stage capability and STAG updates to hold the temporary JDWP connection until A_GO, with a bounded legacy fallback and deterministic protocol tests. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 3c573669-b4d3-4441-85ee-5a906a62b6f7
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
|
@davidnguyen-tech FYI, I was reviewing the history on this JDWP connection. It appears to have been a workaround added for Android Subsystem for Windows, which is now retired/end-of-life. I want to just delete all this code in .NET 12, and didn't want to touch for 11 at this point unless there is a problem. I believe this code path is actually only used in Visual Studio, so not if you do |
Align the protocol-aware readiness deadline with the existing debugger launch timeout and report privacy-safe FEAT, HELO, STAG, completion, fallback, timeout, cancellation, and protocol-error milestones. Co-authored-by: Copilot App <[email protected]>
4 tasks done
Member
Author
|
Closing for #12625 |
jonathanpeppers
added a commit
that referenced
this pull request
Sep 1, 2026
## 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. Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Discontinued on 2026-09-01. The product-compatible preview backport was
validated downstream, but three exact consumer campaigns (
15165979,15165980, and15165981) ended at 0/3 because Android remained at the Javadebugger gate. The investigation has moved to managed-only debugging with
_AndroidAllowJavaDebugging=falseand transientam set-debug-appwithout-w. Java-debugging opt-in is no longer a required outcome, so this proposalis closing unmerged.
Original proposal
Android can acknowledge a temporary JDWP connection before
Debug.waitForDebugger()has advanced far enough for the application to continue reliably. Keeping the connection open for a fixed delay hides that race on newer runtimes and provides no protocol evidence that startup is ready.This change extends the existing JDWP packet path to:
HELOandFEAT;support_boot_stagescapability instead of assuming support from the API level;DEBGas a pre-gate state and wait for a stickyA_GOsnapshot orSTAGtransition;FEATresponse that does not advertise boot stages; andProtocol failures fail closed. Caller cancellation and readiness timeout close an in-flight stream read, preserve distinct
OperationCanceledExceptionandTimeoutExceptionbehavior, and leave forwarded-port cleanup unchanged.The deterministic tests cover pre-gate
DEBG, transition toA_GO, out-of-orderSTAGbefore a staleHELOsnapshot, timeout with a non-cooperative read, caller cancellation,FEATfailure, and the legacy fallback. The focused suite passes 6/6.