Detect and warn when code might not be reached because of being after call to method might be throwing, due to not being handled by try-catch.
This applies to all code blocks. Methods, properties, lambdas, local functions.
public string Data
{
[Throws(typeof(InvalidOperationException))]
public void Foo()
{
throw new InvalidOperationException();
}
[Throws(typeof(InvalidOperationException))]
get
{
Foo(); // This call may throw exception.
// The code after might not run.
return null;
}
}
Detect and warn when code might not be reached because of being after call to method might be throwing, due to not being handled by try-catch.
This applies to all code blocks. Methods, properties, lambdas, local functions.