Using Dictionary<TKey,TValue> in .net compact framework 2.0

D

Daniel.Kristensen

Hi!

I am programming my first application for the .net compact framework.
According to the documentation, the generic Dictionary class is
supported by compact framework 2.0. I am also able to compile my Pocket
PC 2003 project in VS 2005. When I try to run it in the Pocket PC 2003
emulator, however, I get the following exception:

MissingMethodException:
{"Could not load type 'System.Collections.Generic.Dictionary`2' from
assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC'."}

I've tried changing the target platform to Mobile 5.0 instead, but I
get the same eexception when trying to run the program in the Mobile
5.0 emulator.

Are generic Dictionaries not supported in CF after all, or do I need an
upgrade to the Mobile 5.0 SDK or something like that?
 
D

Daniel.Kristensen

Btw, I have tried deploying to a Pocket PC 2003 device and run the
program there, and it gives the same result.

I include the log I retrieve on the Pocket PC 2003 emulator after
following the steps detailed here:
http://blogs.msdn.com/davidklinems/archive/2006/01/31/520899.aspx

========================================
Process [\Program Files\MobileClient\MobileClient.exe]
ProcessID [0x2d846f36]
Date [2006/10/11] (yyyy/mm/dd)
Time [20:45:44] (hh:mm:ss)
NETCF [2.0.5238.00]
Platform [Windows CE v4.21.1088 (PocketPC) WinCE4ARMV4 release V2 ARMV4
IJITv2]
========================================
GAC: Updating GAC [0x0]
GAC: Checking .gac files inside [\Windows\]
GAC: Found [System.SR.2.0.ENU.gac] .gac file.
GAC: Found [Microsoft .NET CF 2.0.GAC] .gac file.
GAC: Done with the file system check. Checking the registry.
GAC: Found [System.SR.2.0.ENU.gac] registry entry.
GAC: Found [Microsoft .NET CF 2.0.GAC] registry entry.
GAC: Done with the registry check. Let's compare.
GAC: Entry [Microsoft .NET CF 2.0.GAC] is up to date.
GAC: Entry [System.SR.2.0.ENU.gac] is up to date.
GAC: GAC is up to date.
Compatibility mode [2.0.0.0]
Loading module [\Windows\GAC_mscorlib_v2_0_0_0_cneutral_1.dll]
Loaded [mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_mscorlib_v2_0_0_0_cneutral_1.dll]
Loading module [\Program Files\MobileClient\MobileClient.exe]
Policy file not present. [\Program
Files\MobileClient\MobileClient.exe.config]
Loading module
[\Windows\GAC_System.Web.Services_v2_0_0_0_cneutral_1.dll]
Loaded [System.Web.Services, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Web.Services_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System_v2_0_0_0_cneutral_1.dll]
Loaded [System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System.Xml_v2_0_0_0_cneutral_1.dll]
Loaded [System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Xml_v2_0_0_0_cneutral_1.dll]
Loading module
[\Windows\GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll]
Loaded [System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System.Drawing_v2_0_0_0_cneutral_1.dll]
Loaded [System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Drawing_v2_0_0_0_cneutral_1.dll]
Missing Type. Class [System.Collections.Generic.Dictionary`2], Assembly
[mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC].
Missing Type. Class [System.Collections.Generic.Dictionary`2], Assembly
[mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC].
==================(end)=================
 
G

Guest

Not that this really helps you, but I don't have any problem using
Dictionary<> in the CF. The only thing I can think of is that you don't have
the CF 2.0 installed on the device that you are running on. It compiles
because you have it on your development machine, but when it actually goes to
load it fails. But this can't be the case either looking at your loading
log. It looks to me like the 2.0 framework is being loaded.

Btw, I have tried deploying to a Pocket PC 2003 device and run the
program there, and it gives the same result.

I include the log I retrieve on the Pocket PC 2003 emulator after
following the steps detailed here:
http://blogs.msdn.com/davidklinems/archive/2006/01/31/520899.aspx

========================================
Process [\Program Files\MobileClient\MobileClient.exe]
ProcessID [0x2d846f36]
Date [2006/10/11] (yyyy/mm/dd)
Time [20:45:44] (hh:mm:ss)
NETCF [2.0.5238.00]
Platform [Windows CE v4.21.1088 (PocketPC) WinCE4ARMV4 release V2 ARMV4
IJITv2]
========================================
GAC: Updating GAC [0x0]
GAC: Checking .gac files inside [\Windows\]
GAC: Found [System.SR.2.0.ENU.gac] .gac file.
GAC: Found [Microsoft .NET CF 2.0.GAC] .gac file.
GAC: Done with the file system check. Checking the registry.
GAC: Found [System.SR.2.0.ENU.gac] registry entry.
GAC: Found [Microsoft .NET CF 2.0.GAC] registry entry.
GAC: Done with the registry check. Let's compare.
GAC: Entry [Microsoft .NET CF 2.0.GAC] is up to date.
GAC: Entry [System.SR.2.0.ENU.gac] is up to date.
GAC: GAC is up to date.
Compatibility mode [2.0.0.0]
Loading module [\Windows\GAC_mscorlib_v2_0_0_0_cneutral_1.dll]
Loaded [mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_mscorlib_v2_0_0_0_cneutral_1.dll]
Loading module [\Program Files\MobileClient\MobileClient.exe]
Policy file not present. [\Program
Files\MobileClient\MobileClient.exe.config]
Loading module
[\Windows\GAC_System.Web.Services_v2_0_0_0_cneutral_1.dll]
Loaded [System.Web.Services, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Web.Services_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System_v2_0_0_0_cneutral_1.dll]
Loaded [System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System.Xml_v2_0_0_0_cneutral_1.dll]
Loaded [System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Xml_v2_0_0_0_cneutral_1.dll]
Loading module
[\Windows\GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll]
Loaded [System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll]
Loading module [\Windows\GAC_System.Drawing_v2_0_0_0_cneutral_1.dll]
Loaded [System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC] from
[\Windows\GAC_System.Drawing_v2_0_0_0_cneutral_1.dll]
Missing Type. Class [System.Collections.Generic.Dictionary`2], Assembly
[mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC].
Missing Type. Class [System.Collections.Generic.Dictionary`2], Assembly
[mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC].
==================(end)=================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top