Fog Creek Software
Discussion Board




.NET BCL Exception List?

With all the discussions regarding the pros/cons of exception handling, I was wondering if anyone knows of a list of exceptions that can be thrown for each/all the methods in the BCL?  Just looking at the VS.NET documentation, it offers very little in the way of this type of information.  Thanks.

GiorgioG
Thursday, October 16, 2003

Giorgio,

The MSDN docs often give a list of exceptions that can be thrown by a procedure, but this list is often incomplete and occasionally incorrect.

Richter's .NET programming book has some useful code that can take an assembly and use reflection to list all of the exceptions produced by that assembly. This would probably be a good starting point.

Mark
----
Author of "Comprehensive VB .NET Debugging"
http://www.apress.com/book/bookDisplay.html?bID=128

Mark Pearce
Thursday, October 16, 2003

Mark - thanks.  I did a search on google groups and found:
http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&selm=eTne%239xjBHA.4404%40tkmsftngp04&rnum=5

Unfortunately it does not show which methods may throw the exceptions listed...

GiorgioG
Thursday, October 16, 2003

[Richter's .NET programming book has some useful code that can take an assembly and use reflection to list all of the exceptions produced by that assembly. This would probably be a good starting point.]

He also list some terrible examples where unfortunately Microsoft have failed to follow their own guidelines on exception handling. Such as System.IO.File.Exists() catching any and *all* exceptions (including system exceptions!) and returning false on that exception. Other design errors make catching exceptions raised impossible!

pietro
Thursday, October 16, 2003

*  Recent Topics

*  Fog Creek Home