Consider the following code
public void AMethodWithAnotherRequiredArgument([Required] string aRequiredArgument)
{
Debug.WriteLine("You passed in a string with a length of {0}", aRequiredArgument.Length);
}
It will trigger a CA1062 (validate arguments of publicmethods), which isn't really valid because PostSharp is performing the validation, in the same way that this
public void AMethodWithARequiredArgument(string aRequiredArgument)
{
Throw.IfNullOrEmpty(aRequiredArgument, "aRequiredArgument");
Debug.WriteLine("You passed in a string with a length of {0}", aRequiredArgument.Length);
}
is valid.
Is there any way that I can make FXCop/SCA recognise that I'm covering the method by way of the [Required] attribute, without adding manual exceptions to every method?
dave