Hotchocolate: NullReferenceException at QueryError.CreateLocations

Created on 1 Sep 2020  路  4Comments  路  Source: ChilliCream/hotchocolate

Describe the bug
I got a NullReferenceException at QueryError.CreateLocations at this line:
(I am sending the codes because I think it's obvious in right in the code)

return syntaxNodes.Select(t => new Location(
                t.Location.Line,
                t.Location.Column)).ToArray();

In my situation t.Location is null and it throws.

I looked a little bit more into it and found that Location is null because RemoteQueryBuilder.CreateOperation generated this ISyntaxNode like this:

return new OperationDefinitionNode(
                location: null,
                name,
                operation,
                variables,
                Array.Empty<DirectiveNode>(),
                new SelectionSetNode(null, fields));

Which is passing the location null.

I have tested HotChocolate v10.4.3 and v10.5.2 and the same behavior.

bug 馃尪 hot chocolate

Most helpful comment

@PascalSenn Location is optional so this might be a bug.

All 4 comments

@michaelstaib did we leave this out on purpose? this probably matters in batched requests

@PascalSenn Location is optional so this might be a bug.

Thanks for the reply and great work.
As @PascalSenn mentioned, I was running a batch query when I encountered this error.

Do you have any suggestion to work it around?

This one is now fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benmccallum picture benmccallum  路  5Comments

IKolosynskyi picture IKolosynskyi  路  3Comments

hognevevle picture hognevevle  路  3Comments

francisrath picture francisrath  路  5Comments

tunurgitr picture tunurgitr  路  4Comments