title: What exception to throw for invalid attribute or attribute parameter?
body: <p>I'm using custom attributes to attach meta-data to class methods. During run-time, those attributes, and their parameters, are validated. Is there a consensus about what existing exception class to throw should an attribute (or attribute parameter) prove invalid?</p>
  
  <p>For instance, given an attribute taking a instance method name as its constructor parameter:</p>
  
  <pre><code>public class StateAttribute : Attribute {
      public string ParentState { get; set; }
      public StateAttribute() {}
  }
  </code></pre>
  
  <p>when used in a class like:</p>
  
  <pre><code>public StateMachine {
     [State]
     public Result TopState(Event e) { ... }
  
     [State( ParentState = "TopState" )]
     public Result NestedState(Event e) { ... }
  }
  </code></pre>
  
  <p>An initialization routine will walk all the methods to which the <code>State</code> attribute has been applied, and resolve the <code>ParentState</code> name to the actual <code>MethodInfo</code>. If (eg. due to a typo) no method with that name can be found, it needs to throw an exception. Since I don't want to invent new exception classes, which one would you suggest?</p>
  
  <p>And just to be sure, there's no way to validate the method names during compile time, right?</p>