Welcome to MSDN Blogs Sign in | Join | Help

Windows Mobile Team Blog

The Official Windows Mobile Team Blog
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 

Posted: Tuesday, February 07, 2006 11:08 AM by windowsmobile
Filed under:

Comments

Ian Blackburn's Weblog said:

# February 15, 2006 6:41 AM

Ian Blackburn's Weblog said:

# February 15, 2006 6:44 AM

Ronny Gydar said:

Thanks for the tip! :-)

I am working in a company in Norway that make mobile applications  (on Symbian and Windows Mobile). We have had quite some challenges with using ATDT-commands (the "phone modem") on Windows Mobile.  This is not yet possible to do with .Net, and we have had to use unmanaged/native code for this, with all the challenges that can give you (and there also seems to be some differences on the different hardware around this from out experience, even from same vendor...we have only tested on HTC models, but have found some different behaviour).

Anyway, with Windows Mobile 5 and .Net CF 2.0 there was a lot of great improvements, and things like accessing contacts/appointments, so forth is unbelievable easy to do now.

The telephone API is fairly simple/minimal at the current version (don't get me wrong, I just luuuv VS 2005, and .Net in general...there just is always room for improvements in everything we do, right!?).

So here is finally my question; Can you give out any information on any roadmap for expanding the phone API in .Net CF, and specifically if you are planning on making ATDT calls 100% accessible through managed/.Net CF?

...hopefully that is one of you next focus areas...!? ...pleeeeease!!!! :-)
# February 15, 2006 3:22 PM

Luis Cabrera said:

We would like to increase the functionality of the Managed APIs we provide to ISVs. Unfortunately currently I cannot disclose specific plans for release of more managed APIs. But I will make a note that adding ATDT commands is something there is demand for.

Tussen Takk!

-Luis E. Cabrera
SDE -Microsoft.
# February 15, 2006 5:18 PM

Ronny Gydar said:

"Tusen takk", right back at yah! :-)

...for the non-scandinavians..."tusen takk" is "thanks"...or actually "a thousand thanks" in Norwegian! :-)
# February 16, 2006 11:52 AM

John said:

Hi. It is straightforward to make a call - but I was hoping someone could point me in the right direction to trap the digits dialled when a smartphone user hits the talk button. I want to be able to perform an operation based on the digits dialled.
# February 23, 2006 7:59 AM

jace said:

So Luis, are you going to answer my email? ;-)
# March 6, 2006 9:24 PM

Luis Cabrera said:

If by email, you mean the comment on Feb. 23...

I don't know of an ISV Public API to trap phone numbers from the dialing application.

I guess you could write your own dialer if you wanted to add extra functionality, and then use the TAPI functions to make the call without showing the dialer application, but I really don't have too much experience with TAPI.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi2/phone_device_functions.asp
# March 7, 2006 12:03 PM

Neal Davis said:

We have had to add this PublicKeyToken to most of the Microsoft.WindowsMobile.* assembly registry keys on our latest build of WM 5.0 in order to be able to call any method in Microsoft.WindowsMobile.Status or else we receive this error. I believe the problem exist in WM 5.0 and possibly in CE 5.0 also. Does your KB article only report this as an issue with WM 5.0 Smartphones?
# June 5, 2006 6:27 PM

Luis Cabrera said:

Non windows mobile 5.0 devices do not include Microsoft.WindowsMobile assemblies, so this issue is specific to windows mobile 5.0 smartphones.

Thanks.
-Luis E. Cabrera
# June 6, 2006 8:09 PM

Masaki said:

I have a similar problem When I use "Microsoft.WindowsMobile.Status".

Does it also need to be added to any registry key??

# November 13, 2006 8:46 PM

magin said:

I'm sorry.

"Microsoft.WindowsMobile.Status"

->"Microsoft.WindowsMobile.Utilities"

# November 13, 2006 11:09 PM

Luis Cabrera said:

You should not have the problem with Microsoft.WindowsMobile.Status.dll.

Could you ellaborate on the problem you have:

1. Device type. (and version)

2. At what point in your code do you get the TypeLoadException?

Thanks!

-Luis Cabrera

# November 15, 2006 12:44 PM

Jim Dionne said:

Thanks for creating this blog entry.  It should fix the problem that we are experiencing.  I made this change to a VB project that does a wireless sync for a Windows Mobile 5.0 smartphone and am trying to intall the CAB file on the emulator.  When I do that, I get a systems permission error.  This only occurs when I try to install the CAB file that has the code to add the HKLM registry keys.  Any ideas on how to modify the permissions/security to fix this problem?  I have not been able to find anything yet.

Thanks,

Jim Dionne

# April 7, 2007 1:08 PM

... said:

Stupore! Amo questo luogo!:)))))))

# April 15, 2007 2:51 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker