TypeLoadException thrown whenever Microsoft.WindowsMobile.Telephony is used in Windows Mobile 5.0 Smartphones.
Hello, the following bug exists today in Windows Mobile 5.0 Smartphone. I wrote a KB article that has this information, but I figured I would write a blog entry here as well. If you are developing for Smartphone and using Microsoft.WindowsMobile.Telephony, Visual Studio will deploy the Microsoft.WindowsMobile.Telephony.dll to the device when you deploy, so you might not realize that this problem occurs until you write a CAB that deploys only your application.
Steps to reproduce:
Create an application that uses the Microsoft.WindowsMobile.Telephony as follows:
1.- Add a reference to Microsoft.WindowsMobile.Telephony.dll
2.- Call the Microsoft.WindowsMobile.Telephony, for example:
Phone myPhone = new Microsoft.WindowsMobile.Telephony.Phone();
myPhone.Talk("555-0100\0");
3.- Build the application, copy it to the Smartphone and run it from the smartphone.
Resolution:
The following two entries need to be added to the registry:
Location: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\Installer\Assemblies\Global]
Type: Multi-String
Name:
Microsoft.WindowsMobile.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Value: "\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll","Microsoft.WindowsMobile.Telephony.dll"
Location: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\Installer\Assemblies\ROM]Type: Multi-StringName: Microsoft.WindowsMobile.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Value: "\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll","Microsoft.WindowsMobile.Telephony.dll"
These entries may be added manually to a Smart Device CAB Project using Microsoft Visual Studio 2005 or they may be added by including them in the RegKeys section of an .inf file that produces a CAB file as follows:
[RegKeys]
"HKLM","Software\Microsoft\.NETCompactFramework\Installer\Assemblies\ROM","Microsoft.WindowsMobile.Telephony, Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35","0x00010000", "\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll","Microsoft.WindowsMobile.Telephony.dll"
"HKLM","Software\Microsoft\.NETCompactFramework\Installer\Assemblies\Global","Microsoft.WindowsMobile.Telephony,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35","0x00010000",
"\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll","Microsoft.WindowsMobile.Telephony.dll"
The problem has been fixed for future releases already.
- Luis Eduardo Cabrera