Minor Issue: Can never be Null
kabua opened this issue · comments
Just trying to promote good programming practices.
The first line of each test reads:
if (cancellationToken == null) throw new ArgumentNullException(nameof(cancellationToken));
CancellationToken
is a struct
and thus can never be null
.
CS0037 - Cannot convert null to 'type' because it is a non-nullable value type.
See: cs0037
While I love testing arguments for valid state and it is better to check than not to check, this check is redundant and more importantly is teaching junior developers, who may not know any better, that struct
s might be null
- which by definition they can't.
Good catch 👍 - feel free to open a PR to resolve this, and any other improvements you might find.
@martincostello I don't use github for pushing so I had some issues pushing my changes back up from SourceTree and I don't think I followed your contrib rules - sorry. However, I hope the changes to the WPF main page are acceptable. Take a look and let me know what you think of the proposed changes.