Design Guidelines for Exceptions
Exceptions are the standard mechanism for reporting errors. Applications and libraries should not use return codes to communicate errors. The use of exceptions adds to a consistent framework design and allows error reporting from members, such as constructors, that cannot have a return type. Exceptions also allow programs to handle the error or terminate as appropriate. The default behavior is to terminate an application if it does not handle a thrown exception. For a detailed discussion of exceptions in the .NET Framework, see Handling and Throwing Exceptions.
Portions Copyright 2005 Microsoft Corporation. All rights reserved.
Portions Copyright Addison-Wesley Corporation. All rights reserved.
For more information on design guidelines, see the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams, published by Addison-Wesley, 2005.
In This Section
Exception Throwing
Describes guidelines for throwing exceptions.Exception Handling
Describes guidelines for catching exceptions.Catching and Throwing Standard Exception Types
Describes guidelines for working with common exceptions provided by the .NET Framework.Designing Custom Exceptions
Describes guidelines for defining new exception types.Exceptions and Performance
Describes guidelines for using design patterns to avoid performance issues related to exceptions.