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.
@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
Most helpful comment
@PascalSenn
Locationis optional so this might be a bug.