jbogard / MediatR

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

Validate arguments of public methods#CA1062 #1053

Closed Zombach closed 2 months ago

Zombach commented 3 months 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 3 months 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 3 months 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 2 months 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.

github-actions[bot] commented 2 months ago

This PR was closed because it has been stalled for 14 days with no activity.