Search code examples
c#asp.net.netgraphqlgraphql-dotnet

GraphTypeFromType gets NullReferenceException


I'm getting this error using dotnet's bindings for Graphql, what may it be the cause?

GraphQL.ExecutionError: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at GraphQL.Types.TypeExtensions.GraphTypeFromType(IType type, ISchema schema)


Solution

  • This is caused by the fact that if the query sent to be executed contains unknown types GraphTypeFromType will fail with that exception.

    This is actually a bug in GraphQL.NET which is fixed by this commit.