Fix WinApp debugger: complete DAP handshake so startDebugging returns true (#40)#48
Open
chiaramooney wants to merge 2 commits into
Open
Fix WinApp debugger: complete DAP handshake so startDebugging returns true (#40)#48chiaramooney wants to merge 2 commits into
chiaramooney wants to merge 2 commits into
Conversation
… true The parent `winapp` debug session uses a NoOpDebugAdapter because the real debugging happens in the child coreclr/node session started inside createDebugAdapterDescriptor. However, the no-op adapter only responded to the `initialize` and `disconnect` requests. It never fired the `initialized` event and never acknowledged the `launch`/`attach` or `configurationDone` requests, so VS Code considered the parent session to have failed to start. As a result vscode.debug.startDebugging(...) (and F5) resolved to `false` even though the app launched and the child debugger attached successfully (issue #40). Complete the DAP launch handshake in NoOpDebugAdapter: - respond to `initialize` advertising supportsConfigurationDoneRequest, then fire the `initialized` event - acknowledge `launch`/`attach` (the response startDebugging keys its result on) - acknowledge `configurationDone` - acknowledge any other request so VS Code never blocks - use a proper monotonic outgoing `seq` counter instead of seq: 0 No change to how the app is launched or attached. Fixes #40 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5ce7415c-8966-43ec-ad27-59a68e7ed74b
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5ce7415c-8966-43ec-ad27-59a68e7ed74b
5643a30 to
c1eba48
Compare
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.
Summary
Fixes #40 — the WinApp debugger's
vscode.debug.startDebugging(...)(and F5) returnedfalseeven when the app launched and the debugger attached successfully.Root cause
The
winappdebug type is a two-tier session:winappsession.WinAppDebugAdapterFactory.createDebugAdapterDescriptordoes the real work — spawnswinapp run --json, then starts a childcoreclr/nodeattach session — and finally returns aNoOpDebugAdapterfor the parent.The parent's
NoOpDebugAdapteronly responded to theinitializeanddisconnectDAP requests. It never fired theinitializedevent and never acknowledged thelaunch/attachorconfigurationDonerequests. VS Code keysstartDebugging's truthy result on the parent session completing its launch handshake, so the missinglaunchresponse made VS Code treat the session as failed-to-start →startDebuggingresolvedfalse, even though the app was already running (all real work happens before the no-op adapter is returned).So it wasn't an early-return/timing bug as the issue speculated — it's an incomplete DAP handshake in the no-op parent adapter.
Fix
Complete the handshake in
NoOpDebugAdapter:initializeadvertisingsupportsConfigurationDoneRequest, then fire theinitializedeventlaunch/attach(the responsestartDebuggingkeys its result on)configurationDoneseqcounter instead ofseq: 0No change to how the app is launched or the child debugger attaches.
Testing
npm run compile-tsc— cleannpm run lint— 0 errors (pre-existing warnings unrelated to this change)npm run package(esbuild production) — build completenpm run test:unit— 592 passing, 0 failing