Tuesday, March 27, 2012

List of Exceptions?

After searching high and low on the web, I have not yet been able to locate a list of exceptions in .NET. Can anyone point me to a resource that lists all the exceptions that can be thrown by .NET?

Thank you!

pszaUm, I'm not sure if it's all of them, but let's say you were to create a Try Catch Block like so...


Try
Catch ex as Exception
End Try

if you were to overwrite Exception in that code, and use Intellisense, you can see a bunch of terms for the exceptions you can catch

You can also Use The Windows Class Viewer to view all the exceptions...(It has a Search)
you can find it in
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin
If you installed without changing defaults

Hope that is helpful
Hello,

all exceptions under .NET inherit from System.Exception, so the list you're looking for is not going to be language specific -- that is, tied to the documentation for a given language.

You can find information concerning specific exceptions in the .NET Framework documentation, just as with the base Exception class, but these entries will only list members for the given class, without offering a clear picture of its own derivation or any consolidated list of subsequent derivatives.

The tool to use in VS.NET is theObject Browser. Search 'Exception' and put together your own list for reference (then use the documentation mentioned above for specific information). Alternately, you can use theWindows Class Viewer (wincv.exe), which ships with the .NET FrameworkSDK, to come up with a quick list (and this is a very handy tool besides).

Ultimately, using reflection techniques (via System.Reflection), you could create your own search tool.
An example of this is available for download atwww.apress.com . Download the source code for Dan Appleman's Moving to VB.NET: Strategies, Concepts, and Code, and look in the Chapter 12 folder for the Derivation2 project. That chapter is devoted to exploring the main .NET namespaces (and, coincidentally, for purposes of illustration, Dan asks the very same question, namely, "[how does one] find all objects that inherit from the class System.Exception.SystemException").

HTH,

0 comments:

Post a Comment