Skip to content

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

@sstublic

Description

@sstublic

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions