OmniSharp / OmniSharp/csharp-language-server-protocol

[DAP] Working with a server which doesn't set "seq" property in some responses

Open
#706 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
638
Forks
109
Avg merge
1m
Merged PRs (30d)
2

Description

Hi,
I am trying get the DAP client working with vscode-lldb server.
Unfortunately, this server sends some responses without seq property set. For example, it sends the the following initialize response:

{
  "type": "response",
  "request_seq": 1,
  "success": true,
  "command": "initialize",
  "body": {
    //...
  }
}

Given such a response, the DapReceiver fails with "No sequence given":

            if (!request.TryGetValue("seq", out var id))
            {
                yield return new InvalidRequest(null, "No sequence given");
                yield break;
            }

I patched the code like this:

            if (!request.TryGetValue("seq", out var id))
            {
                id = 0;
            }

-- and the client worked.

Given that VS Code works with such a server behavior without any problems, I think it is reasonable to "fix" this in the client.

I tried to replace DapReceiver with my inherited class to modify this behavior without changing the library, but didn't find a way to change the service container registration code.

Could you please advice on how to better resolve this issue? Is my fix suitable for the official library packages? Maybe we could log warnings in such cases, but allow the responses without seq?

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 with the DapReceiver response-validation code shown in the issue and trace how missing seq values become InvalidRequest responses. Check the DAP response handling and service-container registration before deciding whether responses without seq should be accepted or warned about; done means the vscode-lldb initialize response no longer causes the client to fail, with behavior covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.