jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
11k stars 1.16k forks source link

Validate arguments of public methods#CA1062 #1053

Open Zombach opened 1 month ago

Zombach commented 1 month ago

Source CA1062

Cause An externally visible method dereferences one of its reference arguments without verifying whether that argument is null (Nothing in Visual Basic).

You can configure this rule to exclude certain types and parameters from analysis. You can also indicate null-check validation methods.

Rule description All reference arguments that are passed to externally visible methods should be checked against null. If appropriate, throw an ArgumentNullException when the argument is null.

If a method can be called from an unknown assembly because it is declared public or protected, you should validate all parameters of the method. If the method is designed to be called only by known assemblies, mark the method internal and apply the InternalsVisibleToAttribute attribute to the assembly that contains the method.

zachpainter77 commented 1 month ago

I'm curious to see what happens with this PR. I have been thinking to myself of doing this with my code but never knowing for sure if the juice is worth the squeeze.

Zombach commented 1 month ago

I'm curious to see what happens with this PR. I have been thinking to myself of doing this with my code but never knowing for sure if the juice is worth the squeeze.

well I'm interested in that too

github-actions[bot] commented 4 days ago

This PR is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 14 days.