Cross-reference: Standard exceptions and error codes

Applies to Windows and Windows Phone

his table is intended as an aid for cross-referencing Windows Runtime app error codes to the Microsoft .NET standard exceptions that you can catch as part of your app's exception handling techniques. For more info on those techniques, see Exception handling for Windows Runtime apps in C# or Visual Basic.

.NET Exception​ (Namespace)HRESULT(s) - symbolicHRESULT(s) - raw
AccessViolationExceptionE_POINTER 0x80004003
AmbiguousMatchException (System.Reflection)COR_E_AMBIGUOUSMATCH 0x8000211d
ApplicationExceptionCOR_E_APPLICATION 0x80131600
AppDomainUnloadedExceptionCOR_E_APPDOMAINUNLOADED 0x80131014
ArithmeticException COR_E_ARITHMETIC 0x80070216
ArgumentException COR_E_ARGUMENT 0x80070057
ArgumentNullException E_POINTER 0x80004003
ArgumentOutOfRangeException COR_E_ARGUMENTOUTOFRANGE 0x80131502
ERROR_NO_UNICODE_TRANSLATION0x80070459
ArrayTypeMismatchException COR_E_ARRAYTYPEMISMATCH 0x80131503
BadImageFormatException COR_E_BADIMAGEFORMAT0x8007000b
CLDB_E_FILE_OLDVER0x80131107
CLDB_E_INDEX_NOTFOUND0x80131124
CLDB_E_FILE_CORRUPT0x8013110e
COR_E_NEWER_RUNTIME0x8013101b
COR_E_ASSEMBLYEXPECTED0x80131018
ERROR_BAD_EXE_FORMAT0x800700c1
ERROR_EXE_MARKED_INVALID0x800700c0
CORSEC_E_INVALID_IMAGE_FORMAT0x8013141d
ERROR_NOACCESS0x800703e6
ERROR_INVALID_ORDINAL0x800700b6
ERROR_INVALID_DLL0x80070482
ERROR_FILE_CORRUPT0x80070570
COR_E_LOADING_REFERENCE_ASSEMBLY0x80131058
META_E_BAD_SIGNATURE0x80131192
CannotUnloadAppDomainExceptionCOR_E_CANNOTUNLOADAPPDOMAIN 0x80131015
ContractException (System.Diagnostics.Contracts)COR_E_CODECONTRACTFAILED 0x80131542
ContextMarshalException (System)COR_E_CONTEXTMARSHAL 0x80131504
CustomAttributeFormatException (System.Reflection)COR_E_CUSTOMATTRIBUTEFORMAT 0x80131605
CryptographicException (System.Security.Cryptography)CORSEC_E_CRYPTO 0x80131430
CryptographicUnexpectedOperationException (System.Security.Cryptography) CORSEC_E_CRYPTO_UNEX_OPER 0x80131431
DataMisalignedException COR_E_DATAMISALIGNED 0x80131541
DirectoryNotFoundException (System.IO)COR_E_DIRECTORYNOTFOUND0x80070003
STG_E_PATHNOTFOUND 0x80030003
CTL_E_PATHNOTFOUND0x800a004c
DivideByZeroException COR_E_DIVIDEBYZERO0x80020012
CTL_E_DIVISIONBYZERO0x800a000b
DllNotFoundException COR_E_DLLNOTFOUND 0x80131524
DuplicateWaitObjectExceptionCOR_E_DUPLICATEWAITOBJECT 0x80131529
EndOfStreamException (System.IO)COR_E_ENDOFSTREAM 0x80070026
EntryPointNotFoundExceptionCOR_E_ENTRYPOINTNOTFOUND 0x80131523
Exception COR_E_EXCEPTION 0x80131500
ExecutionEngineExceptionCOR_E_EXECUTIONENGINE 0x80131506
FieldAccessExceptionCOR_E_FIELDACCESS 0x80131507
FileLoadException (System.IO)COR_E_FILELOAD0x80131621
FUSION_E_INVALID_PRIVATE_ASM_LOCATION0x80131041
FUSION_E_SIGNATURE_CHECK_FAILED0x80131045
FUSION_E_LOADFROM_BLOCKED0x80131051
FUSION_E_CACHEFILE_FAILED0x80131052
FUSION_E_ASM_MODULE_MISSING0x80131042
FUSION_E_INVALID_NAME0x80131047
FUSION_E_PRIVATE_ASM_DISALLOWED0x80131044
FUSION_E_HOST_GAC_ASM_MISMATCH0x80131050
COR_E_MODULE_HASH_CHECK_FAILED0x80131039
FUSION_E_REF_DEF_MISMATCH0x80131040
SECURITY_E_INCOMPATIBLE_SHARE0x80131401
SECURITY_E_INCOMPATIBLE_EVIDENCE0x80131403
SECURITY_E_UNVERIFIABLE0x80131402
COR_E_FIXUPSINEXE0x80131019
ERROR_TOO_MANY_OPEN_FILES0x80070004
ERROR_SHARING_VIOLATION0x80070020
ERROR_LOCK_VIOLATION0x80070021
ERROR_OPEN_FAILED0x8007006e
ERROR_DISK_CORRUPT0x80070571
ERROR_UNRECOGNIZED_VOLUME0x800703ed
ERROR_DLL_INIT_FAILED0x8007045a
FUSION_E_CODE_DOWNLOAD_DISABLED0x80131048
CORSEC_E_MISSING_STRONGNAME0x8013141b
MSEE_E_ASSEMBLYLOADINPROGRESS0x80131016
ERROR_FILE_INVALID0x800703ee
FileNotFoundException (System.IO)ERROR_FILE_NOT_FOUND0x80070002
ERROR_MOD_NOT_FOUND0x8007007e
ERROR_INVALID_NAME0x8007007b
CTL_E_FILENOTFOUND0x800a0035
ERROR_PATH_NOT_FOUND0x80070003
ERROR_BAD_NET_NAME0x80070043
ERROR_BAD_NETPATH0x80070035
ERROR_NOT_READY0x80070015
ERROR_WRONG_TARGET_NAME0x80070574
INET_E_UNKNOWN_PROTOCOL0x800c000d
INET_E_CONNECTION_TIMEOUT0x800c000b
INET_E_CANNOT_CONNECT0x800c0004
INET_E_RESOURCE_NOT_FOUND0x800c0005
INET_E_OBJECT_NOT_FOUND0x800c0006
INET_E_DOWNLOAD_FAILURE0x800c0008
INET_E_DATA_NOT_AVAILABLE0x800c0007
ERROR_DLL_NOT_FOUND0x80070485
CLR_E_BIND_ASSEMBLY_VERSION_TOO_LOW0x80132000
CLR_E_BIND_ASSEMBLY_PUBLIC_KEY_MISMATCH0x80132001
CLR_E_BIND_ASSEMBLY_NOT_FOUND0x80132004
FormatException COR_E_FORMAT 0x80131537
IndexOutOfRangeException COR_E_INDEXOUTOFRANGE 0x80131508
InsufficientExecutionStackExceptionCOR_E_INSUFFICIENTEXECUTIONSTACK 0x80131578
InvalidCastException COR_E_INVALIDCAST 0x80004002
InvalidComObjectException (System.Runtime.InteropServices)COR_E_INVALIDCOMOBJECT 0x80131527
InvalidFilterCriteriaException (System.Reflection)COR_E_INVALIDFILTERCRITERIA 0x80131601
InvalidOleVariantTypeException (System.Runtime.InteropServices)COR_E_INVALIDOLEVARIANTTYPE 0x80131531
InvalidOperationException COR_E_INVALIDOPERATION 0x80131509
InvalidProgramExceptionCOR_E_INVALIDPROGRAM 0x8013153a
IOException (System.IO)COR_E_IO0x80131620
CTL_E_DEVICEIOERROR0x800a0039
IsolatedStorageException (System.IO.IsolatedStorage)ISS_E_ISOSTORE0x80131450
ISS_E_OPEN_STORE_FILE0x80131460
ISS_E_OPEN_FILE_MAPPING0x80131461
ISS_E_MAP_VIEW_OF_FILE0x80131462
ISS_E_GET_FILE_SIZE0x80131463
ISS_E_CREATE_MUTEX0x80131464
ISS_E_LOCK_FAILED0x80131465
ISS_E_FILE_WRITE0x80131466
ISS_E_SET_FILE_POINTER0x80131467
ISS_E_CREATE_DIR0x80131468
ISS_E_CORRUPTED_STORE_FILE0x80131480
ISS_E_STORE_VERSION0x80131481
ISS_E_FILE_NOT_MAPPED0x80131482
ISS_E_BLOCK_SIZE_TOO_SMALL0x80131483
ISS_E_ALLOC_TOO_LARGE0x80131484
ISS_E_USAGE_WILL_EXCEED_QUOTA0x80131485
ISS_E_TABLE_ROW_NOT_FOUND0x80131486
ISS_E_DEPRECATE0x801314a0
ISS_E_CALLER0x801314a1
ISS_E_PATH_LENGTH0x801314a2
ISS_E_MACHINE0x801314a3
ISS_E_STORE_NOT_OPEN0x80131469
ISS_E_MACHINE_DACL0x801314a4
MarshalDirectiveException (System.Runtime.InteropServices)COR_E_MARSHALDIRECTIVE 0x80131535
MethodAccessExceptionCOR_E_METHODACCESS0x80131510
META_E_CA_FRIENDS_SN_REQUIRED0x801311e6
MemberAccessException COR_E_MEMBERACCESS 0x8013151a
MissingFieldExceptionCOR_E_MISSINGFIELD 0x80131511
MissingManifestResourceException (System.Resources)COR_E_MISSINGMANIFESTRESOURCE 0x80131532
MissingMemberException COR_E_MISSINGMEMBER 0x80131512
MissingMethodExceptionCOR_E_MISSINGMETHOD 0x80131513
MulticastNotSupportedExceptionCOR_E_MULTICASTNOTSUPPORTED 0x80131514
NotFiniteNumberExceptionCOR_E_NOTFINITENUMBER 0x80131528
NotImplementedException E_NOTIMPL0x80004001
NotSupportedException COR_E_NOTSUPPORTED0x80131515
NullReferenceException COR_E_NULLREFERENCE0x80004003
ObjectDisposedException COR_E_OBJECTDISPOSED0x80131622
RO_E_CLOSED0x80000013
OperationCanceledException COR_E_OPERATIONCANCELED0x8013153b
OutOfMemoryException E_OUTOFMEMORY0x8007000e
CTL_E_OUTOFMEMORY0x800a0007
OverflowException COR_E_OVERFLOW0x80131516
CTL_E_OVERFLOW0x800a0006
PathTooLongException (System.IO)COR_E_PATHTOOLONG 0x800700ce
PlatformNotSupportedException COR_E_PLATFORMNOTSUPPORTED 0x80131539
System.RankException COR_E_RANK 0x80131517
ReflectionTypeLoadException (System.Reflection)COR_E_REFLECTIONTYPELOAD 0x80131602
RemotingException (System.Runtime.Remoting)COR_E_REMOTING 0x8013150b
RuntimeWrappedException (System.Runtime.CompilerServices)COR_E_RUNTIMEWRAPPED 0x8013153e
ServerException (System.Runtime.Remoting)COR_E_SERVER 0x8013150e
SecurityException (System.Security)COR_E_SECURITY0x8013150a
CORSEC_E_INVALID_STRONGNAME0x8013141a
CTL_E_PERMISSIONDENIED0x800a0046
CORSEC_E_INVALID_PUBLICKEY0x8013141e
CORSEC_E_SIGNATURE_MISMATCH0x80131420
SafeArrayRankMismatchException System.Runtime.InteropServices)COR_E_SAFEARRAYRANKMISMATCH 0x80131538
SafeArrayTypeMismatchException (System.Runtime.InteropServices)COR_E_SAFEARRAYTYPEMISMATCH 0x80131533
SerializationException (System.Runtime.Serialization)COR_E_SERIALIZATION 0x8013150c
StackOverflowExceptionCOR_E_STACKOVERFLOW0x800703e9
CTL_E_OUTOFSTACKSPACE0x800a001c
SynchronizationLockException (System.Threading)COR_E_SYNCHRONIZATIONLOCK 0x80131518
SystemExceptionCOR_E_SYSTEM 0x80131501
TargetException (System.Reflection)COR_E_TARGET 0x80131603
TargetInvocationException (System.Reflection)COR_E_TARGETINVOCATION 0x80131604
TargetParameterCountException (System.Reflection)COR_E_TARGETPARAMCOUNT 0x8002000e
ThreadAbortException (System.Threading)COR_E_THREADABORTED 0x80131530
ThreadInterruptedException (System.Threading)COR_E_THREADINTERRUPTED 0x80131519
ThreadStateException (System.Threading)COR_E_THREADSTATE 0x80131520
ThreadStartException (System.Threading)COR_E_THREADSTART 0x80131525
TypeAccessException COR_E_TYPEACCESS 0x80131543
TypeInitializationException COR_E_TYPEINITIALIZATION 0x80131534
TypeLoadException COR_E_TYPELOAD0x80131522
RO_E_METADATA_NAME_NOT_FOUND0x8000000f
CLR_E_BIND_TYPE_NOT_FOUND0x80132005
TypeUnloadedExceptionCOR_E_TYPEUNLOADED 0x80131013
UnauthorizedAccessException COR_E_UNAUTHORIZEDACCESS0x80070005
CTL_E_PATHFILEACCESSERROR0x800a004b
VerificationException (System.Security)COR_E_VERIFICATION 0x8013150d
PolicyException (System.Security.Policy)CORSEC_E_POLICY_EXCEPTION0x80131416
CORSEC_E_NO_EXEC_PERM0x80131418
CORSEC_E_MIN_GRANT_FAIL0x80131417
XmlSyntaxException (System.Security)CORSEC_E_XMLSYNTAX 0x80131419
COMException (System.Runtime.InteropServices)E_FAIL 0x80004005
ExternalException (System.Runtime.InteropServices)E_FAIL 0x80004005
SEHException (System.Runtime.InteropServices)E_FAIL 0x80004005
ElementNotAvailableException (Windows.UI.Xaml.Automation) (none) 0x802b001f
ElementNotEnabledException (Windows.UI.Xaml.Automation) (none) 0x802b001e
LayoutCycleException (Windows.UI.Xaml) (none) 0x802b0014
XamlParseException (Windows.UI.Xaml.Markup) (none) 0x802b000a

 

Notes

In the ".NET Exception" column of the table above, if the exception name is linked, that exception is part of the classes for .NET for Windows Runtime apps. That means you could raise a new exception of that type in your own code. Or you can catch those exceptions specifically as part of your exception handling for try-catch or UnhandledException. If the exception name is not linked, that exception is not part of the classes for .NET for Windows Runtime. The exceptions that aren't part of the .NET for Windows Runtime set might be encountered in certain interop scenarios, or might come from system or Windows Runtime internals. You won't be able to write catch blocks for them using that specific exception type, because that type isn't known to the .NET libraries you're running for Windows Runtime apps. But you still might be able to read an HRESULT code, look it up from the "HRESULT(s) - raw:" column, and note that there is a .NET exception that corresponds. Or you can catch it as a general Exception. Then you can read the .NET documentation and perhaps learn more about the intention of that exception and the reasons that the originating code might have thrown that exception, even if that exception wasn't represented in the .NET for Windows Runtime types.

If no (Namespace) is listed for a .NET exception, it's from the System namespace.

The constants listed in the "HRESULT(s) - symbolic" column come from a variety of sources. Some are defined in winerror.h. Some are defined in headers that are specific to Component Object Model (COM) programming, or in headers that are part of specific subsystems of Windows. Some require HRESULT_From_Win32 macro usages with codes from even earlier sets of constants (these are the ones preceded with ERROR_). For typical Windows Runtime programming when you're using a .NET language, these headers are not something that you'd have included as part of your project. If you are getting error code info for the cases where the system can't map to a standard exception, you'll probably see it as a raw integer or hex value and won't have automatic support that aliases the numeric code to the Windows named constant values. Still, there's a history of referencing error codes by their named constants instead of raw codes, based on previous Windows error reporting systems. You may be able to use the named constants you see in the table as a way to further research the error in other documentation sources such as forums or support documents, in particular what that error meant for desktop programming, Microsoft Win32 and COM, and so on.

SystemException: In the original .NET exception hierarchy, many exceptions derived from SystemException. For example, System.ArgumentException derived from SystemException. Inheritance from SystemException indicated that an exception was defined by the .NET core. SystemException wasn't included in the set of classes for .NET for Windows Runtime. All the exceptions that would have derived from SystemException under the full framework instead derive from System.Exception.

COMException: The .NET documentation suggests that COMException would be thrown for any unrecognized HRESULT, but that's not the behavior for Windows Runtime apps. Instead, COMException is typically the standard exception used for unmapped exceptions that originate from components. Unmapped exceptions from your own app code or from the system are reported as the base Exception, with a nonstandard HResult value.

ExternalException: Not included in .NET for Windows Runtime. You won't see this in the hierarchy for exceptions that do exist (like SEHException).

Related topics

Exception handling for Windows Store apps in C# or Visual Basic
System.Exception
Exceptions (C++/CX)
Debug Windows Runtime apps in Visual Studio

 

 

Community Additions

ADD
Show:
© 2014 Microsoft