- I'm using Code Contracts ver: 1.4.40602.0
- I copied the necessary Content and Transforms files
- Sandcastle outputs the exceptions based upon my contract requirements
Example Code:
public class MyClass
{
public MyClass(Object obj)
{
Contract.Requires<ArgumentNullException>(obj != null);
}
}
Resulting output (in my documentation):
| Exception | Condition |
|---------------------------------|---------------------------------|
| System.ArgumentNullException | obj == null |
This isn't that bad, however I wonder if there is a way to customize the text of the Condition? I attempted to add a user message Contract.Requires<ArgumentNullException>(obj != null, "obj is null.");
, however this did not solve anything.
In the past I had to write my own xml documentation section for exceptions. Am I going to have to do that again to get what I need?
Disclaimer: Since Code Contracts is (currently) a DevLabs project, this could change, but I'm wondering if it's already available right now... if not, I'll be sure to suggest it.