OmniSharp / OmniSharp/csharp-language-server-protocol
When the server sends a custom request, an exception occurs in the serialization of the'descriptor'
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 638
- Forks
- 109
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Description
Client version:19.0.0
Server send request data:
{"jsonrpc":"2.0","id":5,"method":"vscode/content","params":["https://json.schemastore.org/bower.json"]}
I added a response method to the request when I initialized the client
_client = LanguageClient.PreInit(options =>
{
options.WithInput(_process.StandardOutput.BaseStream)
.WithOutput(_process.StandardInput.BaseStream)
.WithCapability(completionCapability)
.WithCapability(rangeFormattion)
.WithInitializationOptions(initializationOptions)
.OnRequest("vscode/content", this.OnVscodeContentRequest());
});
But I found that when the server sent the request, this.OnVscodeContentRequest() was not triggered.
So I debugged the client source code and found that there was a serialization conversion exception when receiving the request。
/// .\src\Shared\LspRequestRouter.cs line:56-60
if (descriptor.IsDelegatingHandler)
{
var o = @params.ToObject(descriptor.Params.GetGenericArguments()[0], _serializer.JsonSerializer);
paramsValue = Activator.CreateInstance(descriptor.Params, o);
}
This is throw exception:
Error reading string. Unexpected token: StartArray. Path 'params', line 1, position 60.
Is this a problem handled by the client?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Shared/LspRequestRouter.cs around lines 56-60 and reproduce the custom vscode/content request with its array params. Trace the descriptor and serialization path, then verify that the registered OnVscodeContentRequest handler is triggered without the StartArray serialization exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100