Debugging is all nice and good, but when you hit errors during or even before compilation, it might be a bit tricky to figure out what's going on. Here is a list of all the codes that you might hit.
These errors can happen when the metadata processor parses a standard .NET assembly in order to produce the compact PE format for .NET Micro Framework. Appart from some unsupported features, hitting these mostly means a bug either in the parser or a malformed .NET assembly.
0x81010001 CLR_E_PARSER_BAD_TEXT_SIGNATURE
0x81010002 CLR_E_PARSER_BAD_CUSTOM_ATTRIBUTE
0x81010003 CLR_E_PARSER_UNSUPPORTED_MULTIDIM_ARRAY
0x81010004 CLR_E_PARSER_UNKNOWN_MEMBER_REF
0x81010005 CLR_E_PARSER_MISSING_FIELD 0x81010006 CLR_E_PARSER_MISSING_METHOD 0x81010007 CLR_E_PARSER_MISSING_INTERFACE
0x81010008 CLR_E_PARSER_MISSING_TOKEN
0x81010009 CLR_E_PARSER_UNSUPPORTED_GENERICS
Most of them get transferred into exceptions.
0x81000000 CLR_E_UNKNOWN_INSTRUCTION
0x82000000 CLR_E_UNSUPPORTED_INSTRUCTION
0x91000000 CLR_E_STACK_OVERFLOW 0x92000000 CLR_E_STACK_UNDERFLOW
0x95000000 CLR_E_ENTRY_NOT_FOUND
0x96000000 CLR_E_ASSM_WRONG_CHECKSUM
0x97000000 CLR_E_ASSM_PATCHING_NOT_SUPPORTED
0x98000000 CLR_E_SHUTTING_DOWN
0x99000000 CLR_E_SHUTTING_DOWN → System.ObjectDisposedException 0x9A000000 CLR_E_WATCHDOG_TIMEOUT → Microsoft.SPOT.Hardware.WatchdogException 0xA1000000 CLR_E_NULL_REFERENCE → System.NullReferenceException
0xA2000000 CLR_E_WRONG_TYPE
0xA3000000 CLR_E_TYPE_UNAVAILABLE
0xA4000000 CLR_E_INVALID_CAST → System.InvalidCastException 0xA5000000 CLR_E_OUT_OF_RANGE → System.ArgumentOutOfRangeException
0xA7000000 CLR_E_SERIALIZATION_VIOLATION 0xA8000000 CLR_E_SERIALIZATION_BADSTREAM
Please note that jitter has never shipped in any .NET Micro Framework version. It is still in the codebase though, if someone wants to experiment (but would likely need to update it as it uses old memory model).
0x80000000 CLR_E_JITTER_OPCODE_UNSUPPORTED
0x81000000 CLR_E_JITTER_OPCODE_INVALID_SIGNATURE
0x82000000 CLR_E_JITTER_OPCODE_INVALID_TOKEN__TYPE 0x83000000 CLR_E_JITTER_OPCODE_INVALID_TOKEN__METHOD 0x84000000 CLR_E_JITTER_OPCODE_INVALID_TOKEN__FIELD
0x85000000 CLR_E_JITTER_OPCODE_INVALID_OFFSET
0x86000000 CLR_E_JITTER_OPCODE_INVALID_EVALUATION_STACK
The errors 0x80131700 to 0x80131750 are reserved for the .NET Framework loader (shim). If you see an error in this range, the SDK tools likely have not got a chance to run yet.
0x80131700 CLR_E_SHIM_RUNTIMELOAD (Failed to load the runtime.)
0x80131701 CLR_E_SHIM_RUNTIMEEXPORT (failed to find a required export in the runtime) 0x80131702 CLR_E_SHIM_INSTALLROOT (install root is not defined) 0x80131703 CLR_E_SHIM_INSTALLCOMP (expected component of the runtime is not available)
0x80131704 CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUND (a runtime has already been bound for legacy activation policy use) 0x80131705 CLR_E_SHIM_SHUTDOWNINPROGRESS (the operation is invalid because the process may be shutting down)
All errors beginning with 0x8013 come from .NET Framework. They are further split into the following subranges:
0x801310yy Execution Engine 0x801311yy Metadata, TypeLib Export, and CLDB 0x801312yy MetaData Validator 0x801313yy Debugger a Profiler 0x801314yy Security 0x801315yy BCL 0x80131600 to 0x8013161F Reflection 0x80131620 to 0x8013163F System.IO 0x80131640 to 0x8013165F Security 0x80131660 to 0x801316FF BCL 0x801317yy shim 0x801318yy IL Verifier 0x801319yy .NET Framework 0x80131Ayy .NET Framework 0x80131Byy MetaData Validator 0x80131Cyy more debugger errors 0x80131Dyy PE format Validation 0x80131Eyy optimization 0x80131Dyy Ngen errors 0x801330yy VSA errors
A detailed list of these errors is available at Yi Zhang's blog. Errors that users of .NET Micro Framework have encountered:
0x8013110E CLDB_E_FILE_CORRUPT (Record is emitted out of order.)
For completeness, these are the error codes from the native XML reader. When debugging, these should turn into a System.Xml.XmlException.
0xD0000000 XML_S_RETURN_TO_MANAGED_CODE 0xD1000000 XML_E_NEED_MORE_DATA 0xD2000000 XML_E_ERROR 0xD3000000 XML_E_UNEXPECTED_EOF 0xD4000000 XML_E_BAD_NAME_CHAR 0xD5000000 XML_E_UNKNOWN_ENCODING 0xD6000000 XML_E_UNEXPECTED_TOKEN 0xD7000000 XML_E_TAG_MISMATCH 0xD8000000 XML_E_UNEXPECTED_END_TAG 0xD9000000 XML_E_BAD_ATTRIBUTE_CHAR 0xDA000000 XML_E_MULTIPLE_ROOTS 0xDB000000 XML_E_INVALID_ROOT_DATA 0xDC000000 XML_E_XML_DECL_NOT_FIRST 0xDD000000 XML_E_INVALID_XML_DECL 0xDE000000 XML_E_INVALID_XML_SPACE 0xDF000000 XML_E_DUP_ATTRIBUTE_NAME 0xE0000000 XML_E_INVALID_CHARACTER 0xE1000000 XML_E_CDATA_END_IN_TEXT 0xE2000000 XML_E_INVALID_COMMENT_CHARS 0xE3000000 XML_E_LIMIT_EXCEEDED 0xE4000000 XML_E_BAD_OR_UNSUPPORTED_ENTITY 0xE5000000 XML_E_UNDECLARED_NAMESPACE 0xE6000000 XML_E_INVALID_XML_PREFIX_MAPPING 0xE7000000 XML_E_NAMESPACE_DECL_XML_XMLNS 0xE8000000 XML_E_INVALID_PI_NAME 0xE9000000 XML_E_DTD_IS_PROHIBITED 0xEA000000 XML_E_EMPTY_NAME 0xEB000000 XML_E_INVALID_NODE_TYPE 0xEC000000 XML_E_ELEMENT_NOT_FOUND
Have you experienced an error code not mentioned above? Let me know either in comments or by e-mail and I can add them to the list. Also check the CLR header file for the case the error is defined there.