Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

.NET CF Type Load Exception

I received confirmation this morning that an exception I was getting in the application we are building was not a result of our achitecture, but rather a bug in the .NET CF type loader.  Get this though - in order to recreate the exception you have to write some pretty obscure:

Assembly A:

class Foo {}

class Bar<T> {

    T field;


Assembly B:

struct MyValueType{} //has to be user-defined valuetype i.e. struct, enum...

class Child : Foo {}

class MyClass {

    Child c;

    Bar<MyValueType> b;


".NetCF will fail to load MyClass if MyValueType hasn't been preloaded. The workaround is to pre-load the valuetype  (i..e. use it somewhere in the code before MyClass is first referenced).

The problem exists in the .NetCF v2 SP1. We fixed it for the next version of the .NetCF, the fix may also be rolled into next service release of .NetCF v2."  [taken from an email from Roman Batourkov]

  • heating boilers

    2/16/2011 12:27:05 AM |

    I have just studied  NET CF Type Load Exception on your web site and many other articles. I am not going to remark on what everybody else has previously said as some comments are weird, but I do reckon they should comment on your knowledge of the subject. This view is definitely something Id care to consider more of.

Comments are closed