A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Types of Exception

ApplicationException
ApplicationException

User applications, not the common language runtime, throw custom exceptions derived from the ApplicationException class. The ApplicationException class differentiates between exceptions defined by applications versus exceptions defined by the system.

ArgumentException, ArgumentNullException, and ArgumentOutOfRangeException
ArgumentException, ArgumentNullException, and ArgumentOutOfRangeException

Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.(Inherited from Exception.) Remarks ArgumentException is thrown when a method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method.

Exception and SystemException
Exception and SystemException

In a nutshell, System.Exception is defined by applications and System.SystemException is defined by the system (.NET Framework).

InvalidOperationException
InvalidOperationException

InvalidOperationException is used in cases when the failure to invoke a method is caused by reasons other than invalid arguments. Typically, it is thrown when the state of an object cannot support the method call. For example, an InvalidOperationException exception is thrown by methods such as: IEnumerator.

NullReferenceException, IndexOutOfRangeException, and AccessViolationException
NullReferenceException, IndexOutOfRangeException, and AccessViolationException

As you point out, in the article Creating and Throwing Exceptions (C# Programmming Guide) under the topic Things to Avoid When Throwing Exceptions, Microsoft does indeed list System.IndexOutOfRangeException as an exception type that should not be thrown intentionally from your own source code.

OutOfMemoryException
OutOfMemoryException

Describes that a "System.OutOfMemoryException" exception may occur when you use SQL Server Reporting Services to build a report. Provides several methods to resolve this issue.

StackOverflowException
StackOverflowException

StackOverflowException. This usually means that you have a recursive call in your code. A recursion is simply a method that calls itself, causing the stack to overflow and throw the StackoverFlow exception.

Related Question Categories