Open
Description
openedon Sep 22, 2023
Analyzer
Diagnostic ID: CA1062: Validate arguments of public methods
Describe the improvement
When an argument of a public function is used to call another public function which does not accept nullable references
no warning is emitted.
The description of CA1062 says:
All reference arguments that are passed to externally visible methods should be checked against null.
I do understand that the rule seems to only apply when the argument is "dereferenced". I don't understand why this distinction happens as it makes stack traces deeper then they should be.
Notice in the attached example that the method I'm calling does not accept nullable parameters. I think that in this case the warning should also be shown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment