RAPI2 & Multithreading

Feb 23, 2013 at 11:39 AM
Hi!

I have problem with multithreading in RAPI2 managed wrapper.
Steps to reproduce
  1. Create RemoteDeviceManager and get list of devices (Devices property)
  2. Show it to user to select one for some job
  3. Run new thread and pass selected device as parameter
  4. Try to execute RemoteFile.CopyFileToDevice(selectedDevice, ...
  5. Get error
    Unhandled Exception: System.InvalidOperationException: This operation cannot be
    completed on a disconnected device.
    at System.Devices.RemoteDevice.get_ISession() in ...\RAPI2\RemoteDevice.cs:line 806
How can I solve this problem?
Thanks.
Coordinator
Feb 25, 2013 at 3:52 PM
Please look in the documentation and discussions. This topic is covered repeatedly and there is sample code. RemoteDevice does not work across threads.