Problem when calling GetFolderPath and other several methods from other threads

Nov 8, 2010 at 9:36 AM

Hi!

I get the following error when I'm trying to get the folder path on a WinMobile 6.5 device:

Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Devices.Interop.IRAPISession'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{76A78B7D-8E54-4C06-AC38-459E6A1AB5E3}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Does anyone have any suggestions on what I should do?

Thanks!

Alex

Nov 8, 2010 at 9:47 AM

...and this when I call RemoteFile.Exists():

Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Devices.Interop.IRAPISession'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{76A78B7D-8E54-4C06-AC38-459E6A1AB5E3}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Nov 8, 2010 at 10:05 AM

As I've posted in my subject, the problem occurs when I call the RAPI2 methods from another thread.

Coordinator
Nov 8, 2010 at 4:42 PM

There is a documented issue with instantiating and calling methods on different threads. See this discussion for more info.

Nov 8, 2010 at 7:55 PM

Thanks for the reply.

On the same discussion, as a pseudo-solution to this, do you think it would be ok to re-call the RemoteDeviceManager initializer in the other thread and do the rest of the work, in continuation, in that thread? I suppose it could solve the problem, but continiously re-calling the constructor might be problematic, depeinding on the implementation.

What do you think?

Coordinator
Nov 8, 2010 at 11:59 PM

It is worth trying. Looking at the implementation, it may not work due to the initialization of a static class member holding the IRapiDesktop instantiation. Please post your findings.