Skip to content

NullReferenceException in Receiver.GetRenor if "params" property is present but null #24

@tintoy

Description

@tintoy

Hi.

Found a small problem can can silently crash the language server's receiver so it simply stops processing messages. Basically, if you send the server a message like:

{
    "jsonrpc": "2.0",
    "id": "1234",
    "method": "foo",
    "params": null
}

Then the following line crashes with a NullReferenceException because hasParams is true, but @params is null:

if (hasParams && @params.Type != JTokenType.Array && @params.Type != JTokenType.Object)

More generally, it looks like the receiver should probably have a try/catch around each receive cycle.

I'll open 2 PRs to separately deal with the NullReferenceException and the more-general try/catch.

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