June 20, 2013

.NET Framework Exceptions Cheat Sheet

Below is a list of exceptions that can be found in the assemblies which are most commonly used in ASP.NET development. You should be as specific as possible when catching or throwing Exceptions. The more specific you are, the less work the CLR has to do in locating the appropriate catch block, and the more informative your error messages are, which should help speed up identifying the source of any problems.
mscorlib
AbandonedMutexExceptionThe exception that is thrown when one thread acquires a System.Threading.Mutex object that another thread has abandoned by exiting without releasing it.
AccessViolationExceptionThe exception that is thrown when there is an attempt to read or write protected memory.
AmbiguousMatchExceptionThe exception that is thrown when binding to a member results in more than one member matching the binding criteria. This class cannot be inherited.
AppDomainUnloadedExceptionThe exception that is thrown when an attempt is made to access an unloaded application domain.
ApplicationExceptionThe exception that is thrown when a non-fatal application error occurs.
ArgumentExceptionThe exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentNullExceptionThe exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
ArgumentOutOfRangeExceptionThe exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
ArithmeticExceptionThe exception that is thrown for errors in an arithmetic, casting, or conversion operation.
ArrayTypeMismatchExceptionThe exception that is thrown when an attempt is made to store an element of the wrong type within an array.
ASSERT
BadImageFormatExceptionThe exception that is thrown when the file image of a DLL or an executable program is invalid.
CannotUnloadAppDomainExceptionThe exception that is thrown when an attempt to unload an application domain fails.
COMExceptionThe exception that is thrown when an unrecognized HRESULT is returned from a COM method call.
ContextMarshalExceptionThe exception that is thrown when an attempt to marshal an object across a context boundary fails.
CryptographicExceptionThe exception that is thrown when an error occurs during a cryptographic operation.
CryptographicUnexpectedOperationExceptionThe exception that is thrown when an unexpected operation occurs during a cryptographic operation.
CustomAttributeFormatExceptionThe exception that is thrown when the binary format of a custom attribute is invalid.
DataMisalignedExceptionThe exception that is thrown when a unit of data is read from or written to an address that is not a multiple of the data size. This class cannot be inherited.
DecoderFallbackExceptionThe exception that is thrown when a decoder fallback operation fails. This class cannot be inherited.
DirectoryNotFoundExceptionThe exception that is thrown when part of a file or directory cannot be found.
DivideByZeroExceptionThe exception that is thrown when there is an attempt to divide an integral or decimal value by zero.
DllNotFoundExceptionThe exception that is thrown when a DLL specified in a DLL import cannot be found.
DriveNotFoundExceptionThe exception that is thrown when trying to access a drive or share that is not available.
DuplicateWaitObjectExceptionThe exception that is thrown when an object appears more than once in an array of synchronization objects.
EncoderFallbackExceptionThe exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.
EndOfStreamExceptionThe exception that is thrown when reading is attempted past the end of a stream.
EntryPointNotFoundExceptionThe exception that is thrown when an attempt to load a class fails due to the absence of an entry method.
ExecutionEngineExceptionThe exception that is thrown when there is an internal error in the execution engine of the common language runtime. This class cannot be inherited.
ExternalExceptionThe base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions.
FieldAccessExceptionThe exception that is thrown when there is an invalid attempt to access a private or protected field inside a class.
FileLoadExceptionThe exception that is thrown when a managed assembly is found but cannot be loaded.
FileNotFoundExceptionThe exception that is thrown when an attempt to access a file that does not exist on disk fails.
FormatExceptionThe exception that is thrown when the format of an argument does not meet the parameter specifications of the invoked method.
HostProtectionExceptionThe exception that is thrown when a denied host resource is detected.
IdentityNotMappedExceptionRepresents an exception for a principal whose identity could not be mapped to a known identity.
IndexOutOfRangeExceptionThe exception that is thrown when an attempt is made to access an element of an array with an index that is outside the bounds of the array. This class cannot be inherited.
InsufficientMemoryExceptionThe exception that is thrown when a check for sufficient available memory fails. This class cannot be inherited.
InvalidCastExceptionThe exception that is thrown for invalid casting or explicit conversion.
InvalidComObjectExceptionThe exception thrown when an invalid COM object is used.
InvalidFilterCriteriaExceptionThe exception that is thrown in System.Type.FindMembers(System.Reflection.MemberTypes, System.Reflection.BindingFlags, System.Reflection.MemberFilter, System.Object) when the filter criteria is not valid for the type of filter you are using.
InvalidOleVariantTypeExceptionThe exception thrown by the marshaler when it encounters an argument of a variant type that can not be marshaled to managed code.
InvalidOperationExceptionThe exception that is thrown when a method call is invalid for the object's current state.
InvalidProgramExceptionThe exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the program.
IOExceptionThe exception that is thrown when an I/O error occurs.
IsolatedStorageExceptionThe exception that is thrown when an operation in isolated storage fails.
KeyNotFoundExceptionThe exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection.
MarshalDirectiveExceptionThe exception that is thrown by the marshaler when it encounters a System.Runtime.InteropServices.MarshalAsAttribute it does not support.
MemberAccessExceptionThe exception that is thrown when an attempt to access a class member fails.
MetadataException
MethodAccessExceptionThe exception that is thrown when there is an invalid attempt to access a private or protected method inside a class.
MissingFieldExceptionThe exception that is thrown when there is an attempt to dynamically access a field that does not exist.
MissingManifestResourceExceptionThe exception thrown if the main assembly does not contain the resources for the neutral culture, and they are required because of a missing appropriate satellite assembly.
MissingMemberExceptionThe exception that is thrown when there is an attempt to dynamically access a class member that does not exist.
MissingMethodExceptionThe exception that is thrown when there is an attempt to dynamically access a method that does not exist.
MissingSatelliteAssemblyExceptionThe exception that is thrown when the satellite assembly for the resources of the neutral culture is missing.
MulticastNotSupportedExceptionThe exception that is thrown when there is an attempt to combine two delegates based on the System.Delegate type instead of the System.MulticastDelegate type. This class cannot be inherited.
NotFiniteNumberExceptionThe exception that is thrown when a floating-point value is positive infinity, negative infinity, or Not-a-Number (NaN).
NotImplementedExceptionThe exception that is thrown when a requested method or operation is not implemented.
NotSupportedExceptionThe exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.
NullReferenceExceptionThe exception that is thrown when there is an attempt to dereference a null object reference.
ObjectDisposedExceptionThe exception that is thrown when an operation is performed on a disposed object.
OperationCanceledExceptionThe exception that is thrown in a thread upon cancellation of an operation that the thread was executing.
OutOfMemoryExceptionThe exception that is thrown when there is not enough memory to continue the execution of a program.
OverflowExceptionThe exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow.
PathTooLongExceptionThe exception that is thrown when a pathname or filename is longer than the system-defined maximum length.
PlatformNotSupportedExceptionThe exception that is thrown when a feature does not run on a particular platform.
PolicyExceptionThe exception that is thrown when policy forbids code to run.
PrivilegeNotHeldExceptionThe exception that is thrown when a method in the System.Security.AccessControl namespace attempts to enable a privilege that it does not have.
RankExceptionThe exception that is thrown when an array with the wrong number of dimensions is passed to a method.
ReflectionTypeLoadExceptionThe exception that is thrown by the System.Reflection.Module.GetTypes method if any of the classes in a module cannot be loaded. This class cannot be inherited.
RemotingExceptionThe exception that is thrown when something has gone wrong during remoting.
RemotingTimeoutExceptionThe exception that is thrown when the server or the client cannot be reached for a previously specified period of time.
RuntimeWrappedExceptionWraps an exception that does not derive from the System.Exception class. This class cannot be inherited.
SafeArrayRankMismatchExceptionThe exception thrown when the rank of an incoming SAFEARRAY does not match the rank specified in the managed signature.
SafeArrayTypeMismatchExceptionThe exception thrown when the type of the incoming SAFEARRAY does not match the type specified in the managed signature.
SecurityExceptionThe exception that is thrown when a security error is detected.
SEHExceptionRepresents Structured Exception Handler (SEH) errors.
SerializationExceptionThe exception thrown when an error occurs during serialization or deserialization.
ServerExceptionThe exception that is thrown to communicate errors to the client when the client connects to non-.NET Framework applications that cannot throw exceptions.
StackOverflowExceptionThe exception that is thrown when the execution stack overflows because it contains too many nested method calls. This class cannot be inherited.
SynchronizationLockExceptionThe exception that is thrown when a method requires the caller to own the lock on a given Monitor, and the method is invoked by a caller that does not own that lock.
SystemExceptionDefines the base class for predefined exceptions in the System namespace.
TargetExceptionRepresents the exception that is thrown when an attempt is made to invoke an invalid target.
TargetInvocationExceptionThe exception that is thrown by methods invoked through reflection. This class cannot be inherited.
TargetParameterCountExceptionThe exception that is thrown when the number of parameters for an invocation does not match the number expected. This class cannot be inherited.
ThreadAbortExceptionThe exception that is thrown when a call is made to the System.Threading.Thread.Abort(System.Object) method. This class cannot be inherited.
ThreadInterruptedExceptionThe exception that is thrown when a System.Threading.Thread is interrupted while it is in a waiting state.
ThreadStartExceptionThe exception that is thrown when a failure occurs in a managed thread after the underlying operating system thread has been started, but before the thread is ready to execute user code.
ThreadStateExceptionThe exception that is thrown when a System.Threading.Thread is in an invalid System.Threading.Thread.ThreadState for the method call.
TimeoutExceptionThe exception that is thrown when the time allotted for a process or operation has expired.
TypeInitializationExceptionThe exception that is thrown as a wrapper around the exception thrown by the class initializer. This class cannot be inherited.
TypeLoadExceptionThe exception that is thrown when type-loading failures occur.
TypeUnloadedExceptionThe exception that is thrown when there is an attempt to access an unloaded class.
UnauthorizedAccessExceptionThe exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error.
VerificationExceptionThe exception that is thrown when the security policy requires code to be type safe and the verification process is unable to verify that the code is type safe.
WaitHandleCannotBeOpenedExceptionThe exception that is thrown when an attempt is made to open a system mutex or semaphore that does not exist.
XmlSyntaxExceptionThe exception that is thrown when there is a syntax error in XML parsing. This class cannot be inherited.
System
AuthenticationExceptionThe exception that is thrown when authentication fails for an authentication stream.
CheckoutExceptionThe exception that is thrown when an attempt to check out a file that is checked into a source code management program is canceled or fails.
ConfigurationExceptionThe exception that is thrown when a configuration system error has occurred.
CookieExceptionThe exception that is thrown when an error is made adding a System.Net.Cookie to a System.Net.CookieContainer.
HttpListenerExceptionThe exception that is thrown when an error occurs processing an HTTP request.
InternalBufferOverflowExceptionThe exception thrown when the internal buffer overflows.
InternalException
InvalidAsynchronousStateExceptionThrown when a thread on which an operation should execute no longer exists or has no message loop.
InvalidCredentialExceptionThe exception that is thrown when authentication fails for an authentication stream and cannot be retried.
InvalidDataExceptionThe exception that is thrown when a data stream is in an invalid format.
InvalidEnumArgumentExceptionThe exception thrown when using invalid arguments that are enumerators.
LicenseExceptionRepresents the exception thrown when a component cannot be granted a license.
NetworkInformationExceptionThe exception that is thrown when an error occurs while retrieving network information.
PingExceptionThe exception that is thrown when a System.Net.NetworkInformation.Ping.Send or System.Net.NetworkInformation.Ping.SendAsync method calls a method that throws an exception.
ProtocolViolationExceptionThe exception that is thrown when an error is made while using a network protocol.
SemaphoreFullExceptionThe exception that is thrown when the System.Threading.Semaphore.Release method is called on a semaphore whose count is already at the maximum.
SettingsPropertyIsReadOnlyExceptionProvides an exception for read-only System.Configuration.SettingsProperty objects.
SettingsPropertyNotFoundExceptionProvides an exception for System.Configuration.SettingsProperty objects that are not found.
SettingsPropertyWrongTypeExceptionProvides an exception that is thrown when an invalid type is used with a System.Configuration.SettingsProperty object.
SmtpExceptionRepresents the exception that is thrown when the System.Net.Mail.SmtpClient is not able to complete a System.Net.Mail.SmtpClient.Send or System.Net.Mail.SmtpClient.SendAsync operation.
SmtpFailedRecipientExceptionRepresents the exception that is thrown when the System.Net.Mail.SmtpClient is not able to complete a System.Net.Mail.SmtpClient.Send or System.Net.Mail.SmtpClient.SendAsync operation to a particular recipient.
SmtpFailedRecipientsExceptionThe exception that is thrown when e-mail is sent using an System.Net.Mail.SmtpClient and cannot be delivered to all recipients.
SocketExceptionThe exception that is thrown when a socket error occurs.
UriFormatExceptionThe exception that is thrown when an invalid Uniform Resource Identifier (URI) is detected.
WarningExceptionSpecifies an exception that is handled as a warning instead of an error.
WebExceptionThe exception that is thrown when an error occurs while accessing the network through a pluggable protocol.
Win32ExceptionThrows an exception for a Win32 error code.
System.Configuration
ConfigurationErrorsExceptionThe current value is not one of the System.Web.Configuration.PagesSection.EnableSessionState values.
ProviderExceptionThe exception that is thrown when a configuration provider error has occurred. This exception class is also used by providers to throw exceptions when internal errors occur within the provider that do not map to other pre-existing exception classes.
System.Core

AssertionException
AssumptionException
EventLogExceptionRepresents the base class for all the exceptions that are thrown when an error occurs while reading event log related information.
EventLogInvalidDataExceptionRepresents the exception thrown when an event provider publishes invalid data in an event.
EventLogNotFoundExceptionRepresents the exception that is thrown when a requested event log (usually specified by the name of the event log or the path to the event log file) does not exist.
EventLogProviderDisabledExceptionRepresents the exception that is thrown when a specified event provider name references a disabled event provider. A disabled event provider cannot publish events.
EventLogReadingExceptionRepresents an exception that is thrown when an error occurred while reading, querying, or subscribing to the events in an event log.
InstanceNotFoundExceptionThe exception thrown to indicate that no instances are returned by a provider.
InstrumentationBaseExceptionRepresents the base provider-related exception.
InstrumentationExceptionRepresents a provider-related exception.
InvalidTimeZoneExceptionThe exception that is thrown when time zone information is invalid.
InvariantException
LockRecursionExceptionThe exception that is thrown when recursive entry into a lock is not compatible with the recursion policy for the lock.
PostconditionException
PreconditionException
SystemCore_EnumerableDebugViewEmptyException
TimeZoneNotFoundExceptionThe exception that is thrown when a time zone cannot be found.
System.Data
ConstraintExceptionRepresents the exception that is thrown when attempting an action that violates a constraint.
DataExceptionRepresents the exception that is thrown when errors are generated using ADO.NET components.
DBConcurrencyExceptionThe exception that is thrown by the System.Data.Common.DataAdapter during an insert, update, or delete operation if the number of rows affected equals zero.
DbExceptionThe base class for all exceptions thrown on behalf of the data source.
DeletedRowInaccessibleExceptionRepresents the exception that is thrown when an action is tried on a System.Data.DataRow that has been deleted.
DuplicateNameExceptionRepresents the exception that is thrown when a duplicate database object name is encountered during an add operation in a System.Data.DataSet -related object.
EvaluateExceptionRepresents the exception that is thrown when the System.Data.DataColumn.Expression property of a System.Data.DataColumn cannot be evaluated.
InRowChangingEventExceptionRepresents the exception that is thrown when you call the System.Data.DataRow.EndEdit method within the System.Data.DataTable.RowChanging event.
InvalidConstraintExceptionRepresents the exception that is thrown when incorrectly trying to create or access a relation.
InvalidExpressionExceptionRepresents the exception that is thrown when you try to add a System.Data.DataColumn that contains an invalid System.Data.DataColumn.Expression to a System.Data.DataColumnCollection.
InvalidUdtExceptionThrown when SQL Server or the ADO.NET System.Data.SqlClient provider detects an invalid user-defined type (UDT).
MissingPrimaryKeyExceptionRepresents the exception that is thrown when you try to access a row in a table that has no primary key.
ModuleLoadException
ModuleLoadExceptionHandlerException
NoNullAllowedExceptionRepresents the exception that is thrown when you try to insert a null value into a column where System.Data.DataColumn.AllowDBNull is set to false.
OdbcExceptionThe exception that is generated when a warning or error is returned by an ODBC data source. This class cannot be inherited.
OleDbExceptionThe exception that is thrown when the underlying provider returns a warning or error for an OLE DB data source. This class cannot be inherited.
OperationAbortedExceptionThis exception is thrown when an ongoing operation is aborted by the user.
ReadOnlyExceptionRepresents the exception that is thrown when you try to change the value of a read-only column.
RowNotInTableExceptionRepresents the exception that is thrown when you try to perform an operation on a System.Data.DataRow that is not in a System.Data.DataTable.
SqlAlreadyFilledExceptionThe System.Data.SqlTypes.SqlAlreadyFilledException class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.
SqlExceptionThe exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.
SqlNotFilledExceptionThe System.Data.SqlTypes.SqlNotFilledException class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.
SqlNullValueExceptionThe exception that is thrown when the Value property of a System.Data.SqlTypes structure is set to null.
SqlTruncateExceptionThe exception that is thrown when you set a value into a System.Data.SqlTypes structure would truncate that value.
SqlTypeExceptionThe base exception class for the System.Data.SqlTypes.
StrongTypingExceptionThe exception that is thrown by a strongly typed System.Data.DataSet when the user accesses a DBNull value.
SyntaxErrorExceptionRepresents the exception that is thrown when the System.Data.DataColumn.Expression property of a System.Data.DataColumn contains a syntax error.
TypedDataSetGeneratorExceptionThe exception that is thrown when a name conflict occurs while generating a strongly typed System.Data.DataSet.
VersionNotFoundExceptionRepresents the exception that is thrown when you try to return a version of a System.Data.DataRow that has been deleted.
System.Data.Entity
EntityCommandCompilationExceptionRepresents errors that occur during command compilation; when a command tree could not be produced to represent the command text.
EntityCommandExecutionExceptionRepresents errors that occur when the underlying storage provider could not execute the specified command. This exception usually wraps a provider-specific exception.
EntityExceptionRepresents Entity Framework-related errors that occur in the EntityClient namespace. The EntityException is the base class for all Entity Framework exceptions thrown by the EntityClient.
EntitySqlExceptionRepresents errors that occur when parsing Entity SQL command text. This exception is thrown when syntactic or semantic rules are violated.
InternalMappingException
InvalidCommandTreeExceptionThe exception that is thrown to indicate that a command tree is invalid.
MappingExceptionThe exception that is thrown when mapping related service requests fail.
MetadataExceptionThe exception that is thrown when metadata related service requests fails.
ObjectNotFoundExceptionThe exception that is thrown when an object is not present.
OptimisticConcurrencyExceptionThe exception that is thrown when an optimistic concurrency violation occurs.
ProviderIncompatibleExceptionThe exception that is thrown when the underlying data provider is incompatible with the Entity Framework.
UpdateExceptionThe exception that is thrown when modifications to object instances cannot be persisted to the data store.
System.Data.Linq
ChangeConflictExceptionThrown when an update fails because database values have been updated since the client last read them.
DuplicateKeyExceptionThrown when an attempt is made to add an object to the identity cache by using a key that is already being used.
ForeignKeyReferenceAlreadyHasValueExceptionRepresents errors that occur when an attempt is made to change a foreign key when the entity is already loaded.
System.Data.Services
DataServiceExceptionRepresents an instance of the System.Data.Services.DataServiceException class with a specified message that describes the error.
System.Web
DatabaseNotEnabledForNotificationExceptionThe exception that is thrown when a SQL Server database is not enabled to support dependencies associated with the System.Web.Caching.SqlCacheDependency class. This class cannot be inherited.
HostingEnvironmentException
HttpCompileExceptionThe exception that is thrown when a compiler error occurs.
HttpExceptionDescribes an exception that occurred during the processing of HTTP requests.
HttpParseExceptionThe exception that is thrown when a parse error occurs.
HttpRequestValidationExceptionThe exception that is thrown when a potentially malicious input string is received from the client as part of the request data. This class cannot be inherited.
HttpUnhandledExceptionThe exception that is thrown when a generic exception occurs.
MembershipCreateUserExceptionThe exception that is thrown when a user is not successfully created by a membership provider.
MembershipPasswordExceptionThe exception that is thrown when a password cannot be retrieved from the password store.
SqlExecutionExceptionDefines a class for SQL execution exceptions in the System.Web.Management namespace.
TableNotEnabledForNotificationExceptionThe exception that is thrown when a System.Web.Caching.SqlCacheDependency class is used against a database table that is not enabled for change notifications.
ViewStateExceptionRepresents the exception that is thrown when the view state cannot be loaded or validated. This class cannot be inherited.
System.Web.Services

InvalidContentTypeException
InvalidDocumentContentsException
SoapExceptionRepresents the exception that is thrown when an XML Web service method is called over SOAP and an exception occurs.
SoapHeaderExceptionThe SOAP representation of a server error.
System.Xml

UpaException
XmlExceptionReturns detailed information about the last exception.
XmlSchemaExceptionReturns detailed information about the schema exception.
XmlSchemaInferenceExceptionReturns information about errors encountered by the System.Xml.Schema.XmlSchemaInference class while inferring a schema from an XML document.
XmlSchemaValidationExceptionRepresents the exception thrown when XML Schema Definition Language (XSD) schema validation errors and warnings are encountered in an XML document being validated.
XPathExceptionProvides the exception thrown when an error occurs while processing an XPath expression.
XsltCompileExceptionThe exception that is thrown by the Load method when an error is found in the XSLT style sheet.
XsltExceptionThe exception that is thrown when an error occurs while processing an XSLT transformation.

No comments:

Post a Comment