.NET Exceptions (all of them)
July 8, 2009 § 19 Comments
I wanted a list of .NET exceptions. I went looking and couldn’t really find what I was looking for. This post on codinghorror.com helped me get started (especially the work Paul Cotter did), but didn’t really answer the whole question for me. I hacked up the source code that was posted on the site, referenced the XML file generated from the XML comments in the .NET assemblies, linked the exceptions to the MSDN documentation, and generated the following list.
Some of these links are broken (they don’t seem to be documented exceptions). I will probably update this post at some point to remove the links for the exceptions that aren’t documented. I will also post the source code I used to generate the list once all the embarrassing hacks are cleaned up. Check back in a day or two. You can find the source code here.
This list is based on the 3.5 framework.
mscorlib.dll
System
The exception that is thrown when there is an attempt to read or write protected memory.
The exception that is thrown when an attempt is made to access an unloaded application domain.
The exception that is thrown when a non-fatal application error occurs.
The exception that is thrown when one of the arguments provided to a method is not valid.
The 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.
The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
The exception that is thrown for errors in an arithmetic, casting, or conversion operation.
The 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.
CannotUnloadAppDomainException
The exception that is thrown when an attempt to unload an application domain fails.
The exception that is thrown when an attempt to marshal an object across a context boundary fails.
The 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.
The exception that is thrown when there is an attempt to divide an integral or decimal value by zero.
The exception that is thrown when a DLL specified in a DLL import cannot be found.
The exception that is thrown when an object appears more than once in an array of synchronization objects.
The exception that is thrown when an attempt to load a class fails due to the absence of an entry method.
The exception that is thrown when there is an internal error in the execution engine of the common language runtime. This class cannot be inherited.
The exception that is thrown when there is an invalid attempt to access a private or protected field inside a class.
The exception that is thrown when the format of an argument does not meet the parameter specifications of the invoked method.
The 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.
The exception that is thrown when a check for sufficient available memory fails. This class cannot be inherited.
The exception that is thrown for invalid casting or explicit conversion.
The exception that is thrown when a method call is invalid for the object’s current state.
The 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.
The exception that is thrown when an attempt to access a class member fails.
The exception that is thrown when there is an invalid attempt to access a private or protected method inside a class.
The exception that is thrown when there is an attempt to dynamically access a field that does not exist.
The exception that is thrown when there is an attempt to dynamically access a class member that does not exist.
The exception that is thrown when there is an attempt to dynamically access a method that does not exist.
MulticastNotSupportedException
The exception that is thrown when there is an attempt to combine two delegates based on the type instead of the type. This class cannot be inherited.
The exception that is thrown when a floating-point value is positive infinity, negative infinity, or Not-a-Number (NaN).
The exception that is thrown when a requested method or operation is not implemented.
The 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.
The exception that is thrown when there is an attempt to dereference a null object reference.
The exception that is thrown when an operation is performed on a disposed object.
The exception that is thrown in a thread upon cancellation of an operation that the thread was executing.
The exception that is thrown when there is not enough memory to continue the execution of a program.
The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow.
The exception that is thrown when a feature does not run on a particular platform.
The exception that is thrown when an array with the wrong number of dimensions is passed to a method.
The exception that is thrown when the execution stack overflows because it contains too many nested method calls. This class cannot be inherited.
Defines the base class for predefined exceptions in the namespace.
The exception that is thrown when the time allotted for a process or operation has expired.
The exception that is thrown as a wrapper around the exception thrown by the class initializer. This class cannot be inherited.
The exception that is thrown when type-loading failures occur.
The exception that is thrown when there is an attempt to access an unloaded class.
The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error.
System.Collections.Generic
The exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection.
System.IO
The exception that is thrown when part of a file or directory cannot be found.
The exception that is thrown when trying to access a drive or share that is not available.
The exception that is thrown when reading is attempted past the end of a stream.
The exception that is thrown when a managed assembly is found but cannot be loaded.
The exception that is thrown when an attempt to access a file that does not exist on disk fails.
The exception that is thrown when an I/O error occurs.
The exception that is thrown when a pathname or filename is longer than the system-defined maximum length.
System.IO.IsolatedStorage
The exception that is thrown when an operation in isolated storage fails.
System.Reflection
The exception that is thrown when binding to a member results in more than one member matching the binding criteria. This class cannot be inherited.
CustomAttributeFormatException
The exception that is thrown when the binary format of a custom attribute is invalid.
InvalidFilterCriteriaException
The exception that is thrown in when the filter criteria is not valid for the type of filter you are using.
MetadataException
ReflectionTypeLoadExceptionThe exception that is thrown by the method if any of the classes in a module cannot be loaded. This class cannot be inherited.
Represents the exception that is thrown when an attempt is made to invoke an invalid target.
The exception that is thrown by methods invoked through reflection. This class cannot be inherited.
The exception that is thrown when the number of parameters for an invocation does not match the number expected. This class cannot be inherited.
System.Resources
MissingManifestResourceException
The 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.
MissingSatelliteAssemblyException
The exception that is thrown when the satellite assembly for the resources of the neutral culture is missing.
System.Runtime.CompilerServices
Wraps an exception that does not derive from the class. This class cannot be inherited.
System.Runtime.InteropServices
The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.
The base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions.
The exception thrown when an invalid COM object is used.
InvalidOleVariantTypeException
The exception thrown by the marshaler when it encounters an argument of a variant type that can not be marshaled to managed code.
The exception that is thrown by the marshaler when it encounters a it does not support.
SafeArrayRankMismatchException
The exception thrown when the rank of an incoming SAFEARRAY does not match the rank specified in the managed signature.
SafeArrayTypeMismatchException
The exception thrown when the type of the incoming SAFEARRAY does not match the type specified in the managed signature.
Represents Structured Exception Handler (SEH) errors.
System.Runtime.Remoting
The exception that is thrown when something has gone wrong during remoting.
The exception that is thrown when the server or the client cannot be reached for a previously specified period of time.
The exception that is thrown to communicate errors to the client when the client connects to non-.NET Framework applications that cannot throw exceptions.
System.Runtime.Serialization
The exception thrown when an error occurs during serialization or deserialization.
System.Security
The exception that is thrown when a denied host resource is detected.
The exception that is thrown when a security error is detected.
The 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.
The exception that is thrown when there is a syntax error in XML parsing. This class cannot be inherited.
System.Security.AccessControl
The exception that is thrown when a method in the namespace attempts to enable a privilege that it does not have.
System.Security.Cryptography
The exception that is thrown when an error occurs during a cryptographic operation.
CryptographicUnexpectedOperationException
The exception that is thrown when an unexpected operation occurs during a cryptographic operation.
System.Security.Policy
The exception that is thrown when policy forbids code to run.
System.Security.Principal
Represents an exception for a principal whose identity could not be mapped to a known identity.
System.Text
The exception that is thrown when a decoder fallback operation fails. This class cannot be inherited.
The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.
System.Threading
The exception that is thrown when one thread acquires a object that another thread has abandoned by exiting without releasing it.
The 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.
The exception that is thrown when a call is made to the method. This class cannot be inherited.
The exception that is thrown when a is interrupted while it is in a waiting state.
The 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.
The exception that is thrown when a is in an invalid for the method call.
WaitHandleCannotBeOpenedException
The exception that is thrown when an attempt is made to open a system mutex or semaphore that does not exist.
System.AddIn.dll
Microsoft.Contracts
Contract+AssertionException
Contract+AssumptionException
Contract+InvariantException
Contract+PostconditionException
Contract+PreconditionExceptionSystem.AddIn.Hosting
AddInBaseInAddInFolderException
AddInSegmentDirectoryNotFoundException
InvalidPipelineStoreExceptionSystem.AddIn.MiniReflection
System.Configuration.dll
System.Configuration
The current value is not one of the values.
System.Configuration.Provider
The 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.Configuration.Install.dll
System.Configuration.Install
The exception that is thrown when an error occurs during the commit, rollback, or uninstall phase of an installation.
System.Data.dll
<CrtImplementationDetails>
Microsoft.SqlServer.Server
Thrown when SQL Server or the ADO.NET provider detects an invalid user-defined type (UDT).
System.Data
Represents the exception that is thrown when attempting an action that violates a constraint.
Represents the exception that is thrown when errors are generated using ADO.NET components.
The exception that is thrown by the during an insert, update, or delete operation if the number of rows affected equals zero.
DeletedRowInaccessibleException
Represents the exception that is thrown when an action is tried on a that has been deleted.
Represents the exception that is thrown when a duplicate database object name is encountered during an add operation in a -related object.
Represents the exception that is thrown when the property of a cannot be evaluated.
Represents the exception that is thrown when you call the method within the event.
Represents the exception that is thrown when incorrectly trying to create or access a relation.
Represents the exception that is thrown when you try to add a that contains an invalid to a .
Represents the exception that is thrown when you try to access a row in a table that has no primary key.
Represents the exception that is thrown when you try to insert a null value into a column where is set to false.
This exception is thrown when an ongoing operation is aborted by the user.
Represents the exception that is thrown when you try to change the value of a read-only column.
Represents the exception that is thrown when you try to perform an operation on a that is not in a .
The exception that is thrown by a strongly typed when the user accesses a DBNull value.
Represents the exception that is thrown when the property of a contains a syntax error.
TypedDataSetGeneratorException
The exception that is thrown when a name conflict occurs while generating a strongly typed .
Represents the exception that is thrown when you try to return a version of a that has been deleted.
System.Data.Common
The base class for all exceptions thrown on behalf of the data source.
System.Data.Odbc
The exception that is generated when a warning or error is returned by an ODBC data source. This class cannot be inherited.
System.Data.OleDb
The exception that is thrown when the underlying provider returns a warning or error for an OLE DB data source. This class cannot be inherited.
System.Data.SqlClient
The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.
System.Data.SqlTypes
The class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.
The class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.
The exception that is thrown when the Value property of a structure is set to null.
The exception that is thrown when you set a value into a structure would truncate that value.
The base exception class for the .
System.Drawing.dll
System.Drawing.Printing
Represents the exception that is thrown when you try to access a printer using printer settings that are not valid.
System.DirectoryServices.dll
System.DirectoryServices
Contains extended error information about an error that occurred when the method is called.
System.DirectoryServices.ActiveDirectory
ActiveDirectoryObjectExistsException
The class exception is thrown when an Active Directory Domain Services object is created and that object already exists in the underlying directory store.
ActiveDirectoryObjectNotFoundException
The class exception is thrown when a requested object is not found in the underlying directory store.
ActiveDirectoryOperationException
The class exception is thrown when an underlying directory operation fails.
ActiveDirectoryServerDownException
The class exception is thrown when a server is unavailable to respond to a service request.
The class exception is thrown when a trust collision occurs during a trust relationship management request.
SyncFromAllServersOperationException
The exception is thrown when the request to synchronize from all servers fails.
System.Management.dll
System.Management
Represents management exceptions.
System.Messaging.dll
System.Messaging
The exception that is thrown if a Microsoft Message Queuing internal error occurs.
System.ServiceProcess.dll
System.ServiceProcess
The exception that is thrown when a specified timeout has expired.
System.Web.dll
System.Web
The exception that is thrown when a compiler error occurs.
Describes an exception that occurred during the processing of HTTP requests.
The exception that is thrown when a parse error occurs.
HttpRequestValidationException
The 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.
The exception that is thrown when a generic exception occurs.
System.Web.Caching
DatabaseNotEnabledForNotificationException
The exception that is thrown when a SQL Server database is not enabled to support dependencies associated with the class. This class cannot be inherited.
TableNotEnabledForNotificationException
The exception that is thrown when a class is used against a database table that is not enabled for change notifications.
System.Web.Hosting
System.Web.Management
Defines a class for SQL execution exceptions in the namespace.
System.Web.Security
The exception that is thrown when a user is not successfully created by a membership provider.
The exception that is thrown when a password cannot be retrieved from the password store.
System.Web.UI
Represents the exception that is thrown when the view state cannot be loaded or validated. This class cannot be inherited.
System.Windows.Forms.dll
System.Windows.Forms
System.Design.dll
System.ComponentModel.Design
Represents the collection of exceptions.
System.ComponentModel.Design.Serialization
The exception that is thrown when line number information is available for a serialization error.
System.Data.Design
DataSourceGeneratorException
DataSourceSerializationException
InternalException
NameValidationException
TypedDataSetGeneratorExceptionThe exception that is thrown when a name conflict occurs while a strongly typed is being generated.
System.Xml.dll
System.Xml
Returns detailed information about the last exception.
System.Xml.Schema
UpaException
XmlSchemaExceptionReturns detailed information about the schema exception.
Returns information about errors encountered by the class while inferring a schema from an XML document.
Represents the exception thrown when XML Schema Definition Language (XSD) schema validation errors and warnings are encountered in an XML document being validated.
System.Xml.XPath
Provides the exception thrown when an error occurs while processing an XPath expression.
System.Xml.Xsl
The exception that is thrown by the Load method when an error is found in the XSLT style sheet.
The exception that is thrown when an error occurs while processing an XSLT transformation.
System.dll
System
The exception that is thrown when an invalid Uniform Resource Identifier (URI) is detected.
System.ComponentModel
InvalidAsynchronousStateException
Thrown when a thread on which an operation should execute no longer exists or has no message loop.
The exception thrown when using invalid arguments that are enumerators.
Represents the exception thrown when a component cannot be granted a license.
Specifies an exception that is handled as a warning instead of an error.
Throws an exception for a Win32 error code.
System.ComponentModel.Design
The 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.
System.Configuration
The exception that is thrown when a configuration system error has occurred.
SettingsPropertyIsReadOnlyException
Provides an exception for read-only objects.
SettingsPropertyNotFoundException
Provides an exception for objects that are not found.
SettingsPropertyWrongTypeException
Provides an exception that is thrown when an invalid type is used with a object.
System.IO
InternalBufferOverflowException
The exception thrown when the internal buffer overflows.
The exception that is thrown when a data stream is in an invalid format.
System.Net
The exception that is thrown when an error is made adding a to a .
The exception that is thrown when an error occurs processing an HTTP request.
InternalException
ProtocolViolationExceptionThe exception that is thrown when an error is made while using a network protocol.
The exception that is thrown when an error occurs while accessing the network through a pluggable protocol.
System.Net.Mail
Represents the exception that is thrown when the is not able to complete a or operation.
Represents the exception that is thrown when the is not able to complete a or operation to a particular recipient.
The exception that is thrown when e-mail is sent using an and cannot be delivered to all recipients.
System.Net.NetworkInformation
The exception that is thrown when an error occurs while retrieving network information.
The exception that is thrown when a or method calls a method that throws an exception.
System.Net.Sockets
The exception that is thrown when a socket error occurs.
System.Security.Authentication
The exception that is thrown when authentication fails for an authentication stream.
The exception that is thrown when authentication fails for an authentication stream and cannot be retried.
System.Threading
The exception that is thrown when the method is called on a semaphore whose count is already at the maximum.
§ 19 Responses to .NET Exceptions (all of them)
Leave a reply to Stephen Vick Cancel reply
[…] — mikevallotton @ 3:06 am I promised I’d post the source code for generating the list of .NET exceptions that I posted earlier. Here it is finally. This just outputs an XML structure to the console. You can redirect the output […]
An exception of type ‘System.Net.Mail.SmtpFailedRecipientException’ occurred in System.dll but was not handled in user code
Additional information: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for resradh@gmail.com
[…] .Net exception list Programming | Tags:.Net, exception I’ve been looking for a complete list of all possible .Net exceptions because I like to throw the appropriate exception type when needed. MSDN doesn’t offer anything like that but I found a blog post on Mike Vallotton’s blog that was exactly what I was looking for. Here it is: .Net exceptions (all of them). […]
currently im working with wcf, client requires that all exception messages are delivered in spanish (servers are in english) so i need a list of all possible exceptions (or most of them) to implement a translation class, any ideas? any one knows where i can get the description of all system.servicemodel namespace exceptions? btw , great code , thanx
i found the fr 3.0 and 3.5 xml comment files at
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5
and
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\en
this is where the vs object browser querys the data.
Look who’s blog has the .Net Exceptions list I needed! Hope all is well with you brother.
-Vick
Small world, Steve…life is great; I hope yours is as well.
[…] https://mikevallotton.wordpress.com/2009/07/08/net-exceptions-all-of-them/ Esta entrada foi publicada em programação. Adicione o link permanenteaos seus favoritos. […]
[…] — mikevallotton @ 1:36 pm Tags: .NET, commonly used, development, exceptions, guidelines My earlier post containing a list of all .NET exceptions gets a lot of traffic. It’s a great reference, but it’s also a really large list and […]
It has covered all Exceptions i needed with good explanation,Thank you.
Nice one, page bookmarked. I’ll be grabbing the source too, in case your blog goes away ever 😉
kewl!
I am so grateful to you for putting this together. This is exactly what I need.
Thanks
I am not positive where you are getting your info, but good topic. I needs to spend a while learning much more or understanding more. Thanks for great info I was on the lookout for this info for my mission.
[…] https://mikevallotton.wordpress.com/2009/07/08/net-exceptions-all-of-them/ […]
[…] https://mikevallotton.wordpress.com/2009/07/08/net-exceptions-all-of-them/ […]
The XML generated was not strictly legal – missing a couple of end tags. There is probably a more elegant fix, but the quick and dirty was to add:
Console.WriteLine(“”); // before main loop
Console.WriteLine(“”); // before “”
Console.WriteLine(“”); // after main loop
But a great program anyway! Thanks.
Oops, the XML tags got stripped from my previous comment. Here they are with angle brackets replaced by square brackets:
Write [ExceptionList] before main loop
Write [/namespace] before writing [/module]
Write [/ExceptionList] after main loop
I love what you guys are up too. This kind of clever work
and reporting! Keep up the amazing works guys I’ve added you guys to our blogroll.