-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Exceptions.AvoidArgumentExceptionDefaultConstructorRule(git)
Sebastien Pouliot edited this page Mar 2, 2011
·
1 revision
Assembly: Gendarme.Rules.Exceptions
Version: git
This rule checks that every System.ArgumentException, System.ArgumentNullException, System.ArgumentOutOfRangeException, or System.DuplicateWaitObjectException exception created is provided with some useful information about the exception being thrown, minimally the parameter name.
Bad example:
public void Add (object key, object value)
{
if ((obj == null) || (key == null)) {
throw new ArgumentNullException ();
}
Inner.Add (key, value);
}
Good example:
public void Add (object key, object value)
{
if (key == null) {
throw new ArgumentNullException ("key");
}
if (obj == value) {
throw new ArgumentNullException ("value");
}
Inner.Add (key, value);
}
- This rule is available since Gendarme 2.0
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!