I am wondering if there is a tool to look for exceptions in C # using static code analysis? Basically I want to select method A () and want a list of all the exceptions thrown by method A () and all methods called by method A (). I tried ReSharper + Agent Johnson and AtomineerUtils , both fail this simple task.
Here is my sample code:
public class Rectangle
{
public int Width { get; set; }
public int Height { get; set; }
public int Area()
{
CheckProperties();
long x = Width * Height;
if (x > 10)
throw new ArgumentOutOfRangeException();
return (int) x;
}
private void CheckProperties()
{
if (Width < 0 || Height < 0)
throw new InvalidOperationException();
}
}
The tool should be able to tell me (in any form) that the Area () method will throw ArgumentOutOfRangeExceptionorInvalidOperationException.
source
share