Value cannot be null for declaryingType when visting FieldInfo
See original GitHub issueHello all! I’m experiencing the following exception in my setup:
System.ArgumentNullException: Value cannot be null.
Parameter name: declaringType
at HotChocolate.Validation.FieldSelectionMergingVisitor.FieldInfo..ctor(IType declaringType, FieldNode field)
at HotChocolate.Validation.FieldSelectionMergingVisitor.VisitField(FieldNode field, IType type, ImmutableStack`1 path)
at HotChocolate.Validation.QueryVisitor.VisitSelectionSet(SelectionSetNode selectionSet, IType type, ImmutableStack`1 path)
at HotChocolate.Validation.QueryVisitor.VisitOperationDefinition(OperationDefinitionNode operation, ImmutableStack`1 path)
at HotChocolate.Validation.FieldSelectionMergingVisitor.VisitDocument(DocumentNode document, ImmutableStack`1 path)
at HotChocolate.Validation.QueryVisitorValidationErrorBase.Validate(ISchema schema, DocumentNode queryDocument)
at HotChocolate.Validation.QueryValidator.Validate(DocumentNode query)
at HotChocolate.Execution.QueryExecuter.CreateQueryInfo(String queryText)
at HotChocolate.Runtime.Cache`1.GetOrCreate(String key, Func`1 create)
at HotChocolate.Execution.QueryExecuter.ExecuteInternalAsync(QueryRequest request, CancellationToken cancellationToken)
at HotChocolate.AspNetCore.QueryMiddlewareBase.HandleRequestAsync(HttpContext context, QueryExecuter queryExecuter)
at HotChocolate.AspNetCore.QueryMiddlewareBase.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
My startup:
services.AddGraphQL(serviceProvider => Schema.Create(options =>
{
options.RegisterServiceProvider(serviceProvider);
options.RegisterQueryType<ObjectType<GraphQLRepository>>();
options.RegisterType<InputObjectType<MapDefinition>>();
}));
My types:
public class GraphQLRepository
{
private DbContext dbc;
public GraphQLRepository(DbContext dbContext)
{
dbc = dbContext;
productMatcher = matcher;
}
// This works!
public async Task<List<EntityFrameworkType>> EntityFrameworkType() => await dbc.EntityFrameworkType.ToListAsync();
// This produces the declaringType cannot be null exception.
public async Task<int> AddNewMap(MapDefinition mapDefinition)
{
return 1;
}
}
public class MapDefinition
{
public int Id { get; set; }
}
I think I’m missing a fundamental concept here…trying to figure it out through the docs and what not. I believe it has something to do with parsing the MapDefinition argument of AddNewMap. I’ve tried IType, and Object/InputObject inheritance wrappers. I’ve also enabled trace level logs in appSettings. Is there any way I can drill deeper?
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Value cannot be null for declaryingType when visting ...
Hello all! I'm experiencing the following exception in my setup: System.ArgumentNullException: Value cannot be null.
Read more >.net - Shouldn't using FieldInfo.SetValue to set a ValueType ...
The value parameter cannot be converted and stored in the field. I do agree that it seems slightly strange, particularly as I generally ......
Read more >Value cannot be null. Parameter name: dest - Unity Forum
I don't know what "ArgumentNullException: Value cannot be null. Parameter name: dest" means or how to fix it but my scene won't render....
Read more >Value cannot be null. Parameter name: _unity_self - ...
I am making 2d game using newest unity, 2022.2.17f1 Now I met this error and this does not indicate any of my code's...
Read more >Value cannot be null. Parameter name
Ok, so the problem was coming from ConfigurationManager. Apparently, ConfigurationManager, scans the SharePoint's web.config file, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have opened a new issue #411 for the nullrefexception… we will fix that with the next release. Although the query was invalid there should never be a nullrefexception from the system. Thanks for reporting that.
Ok, I will have a look at it.