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

Enable nullable reference types for core projects #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

benbryant0
Copy link

This enables nullable reference types for the 3 core projects (Infrastructure.Framework, Domain, Extensions).

I tried enabling it solution-wide but that resulted in another >300 warnings that I didn't want to go through, and fixing them in the test projects didn't seem worthwhile.

I ended up using the null-forgiving operator a lot here, often for cases like nullable elements inside a class where they'd first be checked for any nulls in one place, then accessed in another method that correctly assumed they weren't null. Or cases where obj as Type was used and the type was guaranteed (arguably a cast is better here, but I wanted to change as little as possible). I think a good amount of this kind of thing can be fixed with some restructuring that I might attempt later, but it seemed nice to get this in first, if you'll accept it.

For the `CreateInstance` call, it seems like it's always expected to not be null or should throw, so seems fine to null-forgive here.
For the other two we can be fairly certain the result isn't null.
A lot of null forgiving used here :(
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

Successfully merging this pull request may close these issues.

1 participant