TypeLoadException with SP2

  • Thread starter Thread starter Romu
  • Start date Start date
R

Romu

Hi all,
my software contains some GUIs which are set
as "Localizable". Since I've updated my device with SP2,
every ResourceManager.GetObject call in the
InitializeComponent throws a TypeLoadException.

As this software works well with SP1 and the emulator, I
think it is obviously a version issue but how to solve
it ?

Thanks for your help.
 
Which objects are causing this?

Note that RTM and SP1 contained a bug that allowed desktop references to be
resolved as if they were CF classes, if the corresponding CF library had
already been loaded. Any strong name which contains
PublicKeyToken=b03f5f7f11d50a3a can be considered a desktop reference.
This has been fixed in SP2, and desktop references that previously might
have been resolved will throw a TypeLoadException or MissingMethodException
in SP2.

The exception to this is System.Drawing, loaded via reflection (GetObject).
Since a localized form loads controls via reflection, VS generates strong
names which contain the desktop PublicKeyToken, and CF translates these
(and only these) to CF strong names. So, if what you're loading is in
System.Drawing (or mscorlib) and is a desktop reference, it should work.
Any other desktop reference should fail in SP2.

Stan Adermann
Developer
Microsoft .NET Compact Framework

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Romu" <[email protected]>
| Subject: TypeLoadException with SP2
|
| Hi all,
| my software contains some GUIs which are set
| as "Localizable". Since I've updated my device with SP2,
| every ResourceManager.GetObject call in the
| InitializeComponent throws a TypeLoadException.
|
| As this software works well with SP1 and the emulator, I
| think it is obviously a version issue but how to solve
| it ?
|
| Thanks for your help.
|
 
Stan,
when you set your form as "Localizable", all form and
controls parameters are set through a resource manager,
so for each parameter you have a "GetObject" call. I get
this TypeLoadException at each line of the
InitializeComponent. I changed nothing in my code, just
updated the CF with SP2. And I get as exception
additionnal information "System.Drawing, 1.0.5000 ...".
I'll verify the public key token, but I never referenced
desktop versions in my PPC solution !!
 
Romu,

Because what you're loading is System.Drawing, it should be working even if
it's using the desktop public key. My next suspicion is that the base
class libraries on your device may have become corrupted. Do non-localized
apps work? Have you tried removing and reinstalling SP2?

Stan Adermann
Developer
Microsoft .NET Compact Framework

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Romu" <[email protected]>
| Subject: RE: TypeLoadException with SP2
|
| Stan,
| when you set your form as "Localizable", all form and
| controls parameters are set through a resource manager,
| so for each parameter you have a "GetObject" call. I get
| this TypeLoadException at each line of the
| InitializeComponent. I changed nothing in my code, just
| updated the CF with SP2. And I get as exception
| additionnal information "System.Drawing, 1.0.5000 ...".
| I'll verify the public key token, but I never referenced
| desktop versions in my PPC solution !!
|
|
| >-----Original Message-----
| >Which objects are causing this?
| >
| >Note that RTM and SP1 contained a bug that allowed
| desktop references to be
| >resolved as if they were CF classes, if the
| corresponding CF library had
| >already been loaded. Any strong name which contains
| >PublicKeyToken=b03f5f7f11d50a3a can be considered a
| desktop reference.
| >This has been fixed in SP2, and desktop references that
| previously might
| >have been resolved will throw a TypeLoadException or
| MissingMethodException
| >in SP2.
| >
| >The exception to this is System.Drawing, loaded via
| reflection (GetObject).
| > Since a localized form loads controls via reflection,
| VS generates strong
| >names which contain the desktop PublicKeyToken, and CF
| translates these
| >(and only these) to CF strong names. So, if what you're
| loading is in
| >System.Drawing (or mscorlib) and is a desktop reference,
| it should work.
| >Any other desktop reference should fail in SP2.
| >
| >Stan Adermann
| >Developer
| >Microsoft .NET Compact Framework
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >--------------------
| >| From: "Romu" <[email protected]>
| >| Subject: TypeLoadException with SP2
| >|
| >| Hi all,
| >| my software contains some GUIs which are set
| >| as "Localizable". Since I've updated my device with
| SP2,
| >| every ResourceManager.GetObject call in the
| >| InitializeComponent throws a TypeLoadException.
| >|
| >| As this software works well with SP1 and the emulator,
| I
| >| think it is obviously a version issue but how to solve
| >| it ?
| >|
| >| Thanks for your help.
| >|
| >
| >.
| >
|
 
Yes Stan, non localized apps work well. As (for an
another reason), I've corrupted my VS installation, I
will try again as soon as I can, re-installing the SP2.

I'll post my results soon.

Thanks for your help Stan.
 
Back
Top