Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryRequestAnalyzer throwing a Null exception #11

Closed
DaveRMaltby opened this issue Oct 29, 2022 · 1 comment
Closed

QueryRequestAnalyzer throwing a Null exception #11

DaveRMaltby opened this issue Oct 29, 2022 · 1 comment

Comments

@DaveRMaltby
Copy link
Contributor

This issue is obscuring another issue that I'm having that is preventing me from calling a Mutation of mine. The error that I'm receiving is:
4>CSC : warning AD0001: Analyzer 'ZeroQL.SourceGenerators.Analyzers.QueryRequestAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.

I started debugging the analyer and see the root cause here. At https://github.com/byme8/ZeroQL/blob/main/src/ZeroQL.SourceGenerators/Analyzers/QueryRequestAnalyzer.cs#L73 the ZeroQLRequestLikeContextResolver.Resolve method can return an Error in its Result<GraphQLSourceGenerationContext> instance, but the if condition following the Resolve call only checks for an ErrorWithData<Diagnostic>. Its else then gets called which assumes that there is no error and that requestContext is not null (but it is null). Therefore, an exception occurs at https://github.com/byme8/ZeroQL/blob/main/src/ZeroQL.SourceGenerators/Analyzers/QueryRequestAnalyzer.cs#L83 when trying to get the OperationQuery property.

As for the other error, I'm still trying to pin it down and will create an issue for that, if it isn't something that I'm doing wrong. Love this library by the way. Thanks.

@byme8
Copy link
Owner

byme8 commented Oct 30, 2022

Checkout v2.1.1. Now it handles the case with the Error properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants