Accessing RDOSession on a background thread only works when Redemption is installed

My Windows Forms application is using Outlook Redemption. I recently moved the listing post code to BackgroundWorker

. Everything works fine on my development machine. However, on the client machine, I get this:

Unable to pass COM object of type 'Redemption.RDOSessionClass' to interface type 'Redemption.IRDOSession'. This operation failed because the QueryInterface call for the COM component for the interface with IID '{E54C5168-AA8C-405F-9C14-A4037302BD9D}' failed due to the following error: such an interface is not supported (exception from HRESULT: 0x80004002 (E_NOINTERFACE )).

I found this answer and Troubleshooting FAQ , which involves passing a MAPIOBJECT from an RDOSession UI thread to a background thread and using it there for a new RDOSession object.

So I changed the code. On the UI thread (already logged into the RDOSession):

Me.Bgw.RunWorkerAsync(Email.OlAdmin.Session.MAPIOBJECT)

      

... and then on a background thread:

    Dim sess As New RDOSession
    sess.MAPIOBJECT = e.Argument
    Dim stores As RDOStores = sess.Stores
...etc

      

However, with this I get the same error message.

If I change the code back so that it all runs in the foreground, that's fine.

If, however, I actually install Redemption on the client machine (using an installer that registers the DLL), the background code works fine. This is not an option in production - we ship Redemption with an app and it works without registration.

So I'm confused - it's a threading issue (works fine in the foreground, doesn't work in the background), but passing the MAPIOBJECT to the background worker doesn't help; if i install the dll it runs fine in the background without passing the MAPIOBJECT.

I also tried to completely rebuild the .NET 3.5 application so that it targets .NET 4.6.2, but it still fails in the same way).

How can I fix it so that it runs in the background, but without the need to install Redemption?


Edit : To clarify in response to Dmitry's question:

  • The code fails on the line sess.MAPIOBJECT = e.Argument

    .
  • We have never used RedemptionLoader. EXE includes a manifest containing the CLSID Redemption, and the Redemption DLL is included in the application folder.
+3


source to share





All Articles