Enable nullable reference types for core projects #126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.