Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server unhandled exception when trying to parse traceparent property in Initialize message. Client (VS2019) becomes unresponsive. #609

Open
sstublic opened this issue Jul 1, 2021 · 1 comment

Comments

@sstublic
Copy link

sstublic commented Jul 1, 2021

I'm not sure if I'm missing something obvious, but my scenario is as follows:

Running OmniSharp LanguageServer 0.19.2 and VS 2019 version 16.10.3. When Initialize message is sent, the server reports an error:

OmniSharp.Extensions.JsonRpc.InputProcessingException: There was an error processing input the contents of the buffer were ''
 ---> System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JToken.
   at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
   at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value)
   at Newtonsoft.Json.Linq.Extensions.Value[U](IEnumerable`1 value)
   at OmniSharp.Extensions.JsonRpc.Receiver.GetRenor(JToken object)
   at OmniSharp.Extensions.JsonRpc.Receiver.GetRequests(JToken container)
   at OmniSharp.Extensions.LanguageServer.Server.LspServerReceiver.GetRequests(JToken container)
   at OmniSharp.Extensions.JsonRpc.InputHandler.HandleRequest(ReadOnlySequence`1& request)
   at OmniSharp.Extensions.JsonRpc.InputHandler.ProcessInputStream(CancellationToken cancellationToken)
   --- End of inner exception stack trace ---

After this error VS2019 becomes unresponsive and server doesn't log additional events.

The culprit seems to be the line

TraceParent = properties["traceparent"].FirstOrDefault()?.Value<string>()

VS2019 will provide traceparent value but the above line will always fail with reported exception if there is any value in the property.

It seems to me that line should read:

TraceParent = properties["traceparent"].FirstOrDefault()?.Value.Value<string>()

instead of

TraceParent = properties["traceparent"].FirstOrDefault()?.Value<string>()

However, this would mean that with addition of traceparent/tracestate property parsing NO clients which actually send those values would work at all with OmniSharp 0.19.2. That seems unlikely.

Any ideas what I'm missing?

Thanks!

@NTaylorMullen
Copy link
Contributor

Fixed by: #638

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

No branches or pull requests

2 participants