Microsoft KB Archive/914793

= A .NET Compact Framework application may generate a System.TypeLoadException exception when the application uses the Microsoft.WindowsMobile.Telephony assembly on a Smartphone device =

Article ID: 914793

Article Last Modified on 4/11/2006

-

APPLIES TO


 * Windows Mobile 5.0 for Smartphones

-





Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



SYMPTOMS
When you run a Microsoft .NET Compact Framework-based application that uses the Microsoft.WindowsMobile.Telephony assembly on a Smartphone device, the application may generate a System.TypeLoadException exception.



CAUSE
This problem occurs because the Microsoft.WindowsMobile.Telephony assembly is not correctly installed in the global assemble cache in Microsoft Windows Mobile 5.0 for Smartphone. A TypeLoadException exception occurs when the Microsoft.WindowsMobile.Telephony assembly is loaded.



RESOLUTION
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To resolve this problem, you must add the following two entries 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: &quot;\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll&quot;,&quot;Microsoft.WindowsMobile.Telephony.dll&quot;

Location: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\Installer\Assemblies\ROM]

Type: Multi-String

Name: Microsoft.WindowsMobile.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Value: &quot;\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll&quot;,&quot;Microsoft.WindowsMobile.Telephony.dll&quot;

You may also use Microsoft Visual Studio 2005 to manually add these entries to a Smart Device CAB project. Or you may add these entries by including them in the RegKeys section of an .inf file that produces a CAB file. To do this, use the following formatting:

[RegKeys]

&quot;HKLM&quot;,&quot;Software\Microsoft\.NETCompactFramework\Installer\Assemblies\ROM&quot;,&quot;Microsoft.WindowsMobile.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&quot;,&quot;0x00010000&quot;,&quot;\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll&quot;,&quot;Microsoft.WindowsMobile.Telephony.dll&quot;

&quot;HKLM&quot;,&quot;Software\Microsoft\.NETCompactFramework\Installer\Assemblies\Global&quot;,&quot;Microsoft.WindowsMobile.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&quot;,&quot;0x00010000&quot;,&quot;\Windows\GAC_Microsoft.WindowsMobile.Telephony_v1_0_0_0_cneutral_1.dll&quot;,&quot;Microsoft.WindowsMobile.Telephony.dll&quot;



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
This problem is scheduled to be fixed in Adaptation Kit Update (AKU) 3.0 for Windows Mobile 5.0 for Smartphone.

For more information about how to add registry entry to a CAB project, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/zcebx8f8.aspx



Steps to reproduce the problem
 Make sure that you have the Windows Mobile 5.0 SDK for Smartphone installed. Start Visual Studio 2005. On the File menu, click New, and then click Project. Expand Visual C#, expand Smart Device, and then click Windows Mobile 5.0 Smartphone.</li> Click Device Application, type DeviceApplication1 in the Name box, and then click OK.</li> Add a new LinkLabel control that is named linkLabel1 to the Form1 form.</li> Add a reference to the Microsoft.WindowsMobile.Telephony assembly.</li>  Add the following using statement to Form1.cs: using Microsoft.WindowsMobile.Telephony; </li>  Add the following code to the linkLabel1_click event handler in Form1.cs: Phone myPhone = new Phone; myPhone.Talk(&quot;555-0100\0&quot;); </li> Create a new Smart Device CAB project, and then deploy the application on the Smartphone device.</li></ol>

Additional query words: GAC

Keywords: kbinfo kbbug kbfix kbprb KB914793

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.