Department of InformatiX
Microsoft .NET Micro Framework Tools & Resources

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.

TinyCLR Errors

Assembly parser

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

  1. A type signature cannot be parsed.

0x81010002 CLR_E_PARSER_BAD_CUSTOM_ATTRIBUTE

  1. Wrong signature for custom attribute data.
  2. Wrong member in custom attribute (attributes can contain properties and fields only).
  3. Custom attribute member value cannot be read.
  4. Custom attribute has invalid format.

0x81010003 CLR_E_PARSER_UNSUPPORTED_MULTIDIM_ARRAY

  1. Multi-dimensional arrays are not supported in .NET Micro Framework, however, jagged arrays (arrays of arrays) are.
    // Instead of this: int[,] array = new int[2, 5]; // Try this: int[][] array = new int[2][]; array[0] = new int[5]; array[1] = new int[5];
    (you might want to prefer smaller number of arrays, i.e. use this order even if you needed [5, 2])

0x81010004 CLR_E_PARSER_UNKNOWN_MEMBER_REF

  1. Unsupported member reference (members can be only fields or methods).

0x81010005 CLR_E_PARSER_MISSING_FIELD
0x81010006 CLR_E_PARSER_MISSING_METHOD
0x81010007 CLR_E_PARSER_MISSING_INTERFACE

  1. A field, method or an interface referenced by given type cannot be found.

0x81010008 CLR_E_PARSER_MISSING_TOKEN

  1. A required token was not found during parsing of the assembly.

0x81010009 CLR_E_PARSER_UNSUPPORTED_GENERICS

  1. Generics are not supported in .NET Micro Framework. Check System.Collections namespace for non-generic collections available.

.NET Micro Framework Errors

Most of them get transferred into exceptions.

0x81000000 CLR_E_UNKNOWN_INSTRUCTION

  1. Unknown IL instruction, likely introduced after the interpreter was written. From instructions documented in CLR 4.0, only the reserved prefix2 to prefix7 and prefixref are not recognized.

0x82000000 CLR_E_UNSUPPORTED_INSTRUCTION

  1. Unsupported IL instruction. Most unsafe and generics related instructions are not supported: arglist, calli, ckfinite, cpblk, initblk, jmp, localloc, mkrefany, readonly, refanytype, refanyval.
    Support for ldelem and stelem has been added in .NET Micro Framework 4.4.

0x91000000 CLR_E_STACK_OVERFLOW
0x92000000 CLR_E_STACK_UNDERFLOW

  1. You can easily hit stack overflow with unbounded recursion (eg. method or property calling itself).
  2. Stack underflow is much more harder to get and usually indicates a bug in the native code.

0x95000000 CLR_E_ENTRY_NOT_FOUND

  1. Entrypoint was not found. First thing to try is to check the Startup object in project properties.
  2. Some assembly cannot be resolved. If this is post-deploy error, check that all required assemblies are checked to Deploy in the configuration manager. You can also see if all the assemblies are deployed during deployment in the output window. If this is pre-deploy error, make sure all your references are OK.
  3. Failed to get data for ManifestResource. Try cleaning the solution/rebuild all.

0x96000000 CLR_E_ASSM_WRONG_CHECKSUM

  1. An assembly has native calls, but the table with native calls in device does not match the table of the assembly. Usually this happens when there is a mismatch of the firmware version, and the affected assembly is pointed out in the output window. Unless you are doing some fancy stuff, you need to update firmware on the device.

0x97000000 CLR_E_ASSM_PATCHING_NOT_SUPPORTED

  1. Method patching is not supported. Does not look like metadata processor generates assemblies that would generate this error.

0x98000000 CLR_E_SHUTTING_DOWN

  1. This error happens when Windows is shutting down while waiting for the debugger.

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

  1. Type checking is present through the all runtime. This error is likely due to a bug in the native code.

0xA3000000 CLR_E_TYPE_UNAVAILABLE

  1. Some assembly reference cannot be resolved. Check the previous messages in the output window for hints what assembly is missing, and ensure they are being deployed. You can also clean the deployment memory with MFDeploy and try to deploy again.

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

  1. There are several contracts that serialization data must fullfil.

Jitter

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

  1. The data type is not valid for given operand.
  2. The data type is not valid for given condition (eg. reference and boxed types are not valid for boolean testing).
  3. The condition operator itself is not valid in the given context.
  4. The data type is not valid for given operation (eg. weak references cannot be used directly, getting address of date and time fields is not supported etc.).
  5. The operation itself is invalid (unknown).
  6. Unsupported array element size (1, 2, 4, 8 and 12 bytes are supported).
  7. Unsupported operator parameter (signature).

0x81000000 CLR_E_JITTER_OPCODE_INVALID_SIGNATURE

  1. Invalid field/method/type/string token 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

  1. A referenced field, method or type cannot be found.

0x85000000 CLR_E_JITTER_OPCODE_INVALID_OFFSET

  1. Too many branches in a method.
  2. Invalid offset in method's IL.

0x86000000 CLR_E_JITTER_OPCODE_INVALID_EVALUATION_STACK

  1. Corrupted stack during evaluation.

CLR Shim Errors

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.)

  1. As of .NET Micro Framework 4.3, the SDK tools require .NET Framework 2.0 to run. All supported Visual Studio versions are happy with 4.0 version only, so make sure you have an older version of .NET Framework installed as well (anything from 2.0 to 3.5.x should do). For Windows Vista and later, you can install it from the Turn Windows features on or off dialog, but internet connection might be required.

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)

  1. This looks like the .NET Framework installation is corrupted or incomplete, and I would suggest reinstalling the .NET Framework; at least.

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)

  1. This can be caused by interference with other software. Restarting should do, and if not, you might need to find the other product that is using the runtime in this way.

Other .NET errors

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.)

  1. Invalid file format - in .NET world represented by the BadImageFormatException exception. Unless you generated the assembly yourself in a fancy way, the first thing on the list is to check the target platform (x86/x64/ARM). Similarly for .NET Micro Framework - if you are calling metadata processor yourself, make sure you indicated what endianness you are using (the /le and /be switches, respectively).

Native XML reader

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.

Comments
Sign in using Live ID to be able to post comments.