microsoft / microsoft/vscode-debugadapter-node

ProtocolClient.send breaks async stacktraces

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
306
Forks
90
Avg merge
8h 36m
Merged PRs (30d)
3

Description

The following implementation:
https://github.com/microsoft/vscode-debugadapter-node/blob/1621133e71527d9d46438edb766eaf8e731b68f5/testSupport/src/protocolClient.ts#L69-L80
is not async itself and returns the promise immediately without awaiting it. Consequently, if the promise gets rejected with an error, the stack trace in the error does not include either send or its caller. This unnecessarily complicates debugging of e.g. async unit tests that await send() and receive an unexpected error response.

Instead, the callback for doSend should capture the raw response in a wrapper promise, and then send should await that promise and translate it to a throw.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in testSupport/src/protocolClient.ts at the linked ProtocolClient.send implementation and inspect how it calls doSend. Trace the rejected promise path and verify that send awaits a wrapper around the raw response before translating the error. Done means async rejection stack traces include send and its caller.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.