Skip to content

Fix WinApp debugger: complete DAP handshake so startDebugging returns true (#40)#48

Open
chiaramooney wants to merge 2 commits into
mainfrom
chiaramooney/investigate-startdebugging-return
Open

Fix WinApp debugger: complete DAP handshake so startDebugging returns true (#40)#48
chiaramooney wants to merge 2 commits into
mainfrom
chiaramooney/investigate-startdebugging-return

Conversation

@chiaramooney

Copy link
Copy Markdown
Collaborator

Summary

Fixes #40 — the WinApp debugger's vscode.debug.startDebugging(...) (and F5) returned false even when the app launched and the debugger attached successfully.

Root cause

The winapp debug type is a two-tier session:

  1. F5 starts the parent winapp session.
  2. WinAppDebugAdapterFactory.createDebugAdapterDescriptor does the real work — spawns winapp run --json, then starts a child coreclr/node attach session — and finally returns a NoOpDebugAdapter for the parent.

The parent's NoOpDebugAdapter only responded to the initialize and disconnect DAP requests. It never fired the initialized event and never acknowledged the launch/attach or configurationDone requests. VS Code keys startDebugging's truthy result on the parent session completing its launch handshake, so the missing launch response made VS Code treat the session as failed-to-start → startDebugging resolved false, 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:

  • 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 the child debugger attaches.

Testing

  • npm run compile-tsc — clean
  • npm run lint — 0 errors (pre-existing warnings unrelated to this change)
  • npm run package (esbuild production) — build complete
  • npm run test:unit — 592 passing, 0 failing

chiaramooney and others added 2 commits July 13, 2026 11:39
… 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
@chiaramooney chiaramooney force-pushed the chiaramooney/investigate-startdebugging-return branch from 5643a30 to c1eba48 Compare July 13, 2026 19:54
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.

WinApp debugger: startDebugging returns false even when the app launches successfully

1 participant