-
Notifications
You must be signed in to change notification settings - Fork 664
Description
With #2765 merged we have a good basis to tighten the codebase by adding more null guards and allowing for less nullability throughout.
Detailed Description
One of the worst exceptions to debug is NullReferenceException. With ArgumentNullException you at least know which argument was null, which is a huge improvement. Better yet is to alleviate null altogether, or at least move all code dealing with null to the perimeter of the codebase. GitVersion.Core should preferably be completely free of nullable types.
Context
We are plagued with NullReferenceException surfacing its ugly head every so often. See #2763, #2605, #2695, #2734, #2825 and #2631 (comment) for examples. We allow null by having default, argument-free constructors in classes with fields that then become uninitialized, for instance. We also are missing null guards in a lot of constructors that take arguments that should not be allowed to be null.
Possible Implementation
Remove default constructors in classes with fields that need initialization. Add null guards throughout the codebase.