Description
I am trying to use Dap Client to interact with nodejs debug adapter.
But cannot successfully call the initialization request. After confirming that the server received the initialization request and returned the result, the client code was stuck in this step.
public async Task Initialize(CancellationToken token)
{
await DebugAdapterEventingHelper.Run(
_initializeDelegates,
(handler, ct) => handler(this, ClientSettings, ct),
_initializeHandlers.Union(_collection.Select(z => z.Handler).OfType<IOnDebugAdapterClientInitialize>()),
(handler, ct) => handler.OnInitialize(this, ClientSettings, ct),
_concurrency,
token
).ConfigureAwait(false);
RegisterCapabilities(ClientSettings);
_connection.Open();
var serverParams = await this.RequestDebugAdapterInitialize(ClientSettings, token).ConfigureAwait(false);
ServerSettings = serverParams;
await DebugAdapterEventingHelper.Run(
_initializedDelegates,
(handler, ct) => handler(this, ClientSettings, ServerSettings, ct),
_initializedHandlers.Union(_collection.Select(z => z.Handler).OfType<IOnDebugAdapterClientInitialized>()),
(handler, ct) => handler.OnInitialized(this, ClientSettings, ServerSettings, ct),
_concurrency,
token
).ConfigureAwait(false);
_receiver.Initialized();
//await _initializedComplete.ToTask(token);
await DebugAdapterEventingHelper.Run(
_startedDelegates,
(handler, ct) => handler(this, ct),
_startedHandlers.Union(_collection.Select(z => z.Handler).OfType<IOnDebugAdapterClientStarted>()),
(handler, ct) => handler.OnStarted(this, ct),
_concurrency,
token
).ConfigureAwait(false);
_instanceHasStarted.Started = true;
}
In the comment statement on line 24:
await _initializedComplete.ToTask(token);
the value of token is always false, so the program just waits here and cannot continue.
I have obtained the data returned by the server in the client.ServerSettings property, which should indicate that the server has successfully responded to the request.
There is another problem. When I called the 'Launch' request, the 'noDebug' parameter was passed, but the server did not receive the parameter. I don't know what happened in the middle.
var breakResponse = await client.SetBreakpoints(new SetBreakpointsArguments() {
Source = source,
Breakpoints = breakPoints,
SourceModified = false
});
var launchResponse = await client.Launch(new LaunchRequestArguments() {
NoDebug = false,
});
It is also the first time for me to use DAP protocol for communication. This process is more difficult for me
So sometimes I cannot find out whether the problem is on the client side or on the server side. If possible, can you try to test the communication with the Vscode-node-debug2 debug server?
Thanks in advance!
Since I cannot upload some screenshots on the company’s intranet, please let me know if you need more information
More Information:
Dap Client: Omnisharp Dap Client(v0.19.0-beta.4)
Dap Server: vscode-node-debug2(v1.42.5)