I have the following FooClass. There are three methods where two of them can throw an exception.
If have only declared in the HasException method that there can be an exception thrown.
When you have large projects it can be possible that you forget to describe the exceptions in the summary.
It is possible to scan the solution if I have forgotten to declare an exception? In my example are four exceptions (declarations) missing.
public class FooClass
{
public FooClass()
{
HasException();
HasNoException();
HasChildException();
}
/// <summary>
/// This method does not throw an <see cref="Exception"/>.
/// </summary>
public void HasNoException()
{
}
/// <summary>
/// This method is throwing an <see cref="Exception"/>.
/// </summary>
/// <exception cref="Exception">Is immediately thrown.</exception>
public void HasException()
{
throw new Exception();
}
/// <summary>
/// This method can throwing an <see cref="Exception"/> from a method it calls.
/// </summary>
public void HasChildException()
{
//throws an exception
HasException();
//throws also an exception
int.Parse("foo");
}
}
ToolTips
This should be an example how the method should be described
/// <summary>
/// This method can throwing an <see cref="Exception"/> from a method it calls.
/// </summary>
/// <exception cref="Exception"></exception>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="FormatException"></exception>
/// <exception cref="OverflowException"></exception>
public void HasChildException()
{
//throws an exception
HasException();
//throws also an exception
int.Parse("foo");
}


