Is there any C# code analysis tool that can verify if exceptions that are in the XML comments are handled somewhere up in the call chain?
Assuming only exceptions that need to be handled specifically are xml commented it would be rather useful.
Is there any C# code analysis tool that can verify if exceptions that are in the XML comments are handled somewhere up in the call chain?
Assuming only exceptions that need to be handled specifically are xml commented it would be rather useful.
I haven't heard of any - since you can't use reflection to get at the comments in a compiled assembly, I don't think this is possible. A compiler or code analysis tool could possibly check whether any thrown (or downstream?) exceptions are properly commented in the XML comments, but that's about it.
You might be interested in Spec# from Microsoft Research. According to the project site:
That, I think, is about as close as you're going to get. It will do what Java does: force callers of functions which throw exceptions to either handle those exceptions or state in their metadata that they themselves propagate/throw those exceptions, until the exception is handled somewhere. I don't know if Spec# will let you check only specific exception types, though.