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

Compile errors due to missing nullable reference annotations on APIs that accept null #635

Closed
spanglerco opened this issue Oct 20, 2022 · 2 comments
Assignees
Labels

Comments

@spanglerco
Copy link

1. Description

With the upgrade to 1.2.20, the library has enabled nullable reference types (in #620 I believe), but IDynamicLinqCustomTypeProvider wasn't updated to specify that ResolveType and ResolveTypeBySimpleName may return null (as stated in the documentation for the methods). This leads to compile error CS8766 if my implementation of the interface specifies a nullable return type (so that we can return null), or CS8603 if our code doesn't specify nullable return type but returns null anyway. The workaround is to return null!, which defeats the purpose of enabling nullability checks. Our code is currently returning null from GetExtensionMethods as well, so that may need a nullable reference return type.

Additionally, the DynamicExpressionParser.ParseLambda method specifies params object[] values, but my code was previously passing an object?[] to be able to substitute in null values. This results in error CS8620.

I'm not sure if there are more APIs that are missing nullable reference annotations, but these were the ones our code has seen when trying to upgrade. Also, these are technically compiler warnings, though we treat them as errors.

2. Exception

N/A

3. Fiddle or Project

https://dotnetfiddle.net/ULrkpy

4. Any further technical details

Add any relevant detail that can help us.

@StefH
Copy link
Collaborator

StefH commented Oct 20, 2022

@spanglerco
Thank you for this issue, I'll fix the mentioned classes and do a quick check on other API calls.

If you find any other issues, please add these to this issue.

@StefH StefH self-assigned this Oct 20, 2022
@StefH StefH added the bug label Oct 20, 2022
@StefH
Copy link
Collaborator

StefH commented Oct 21, 2022

#636

@StefH StefH closed this as completed Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants