0

I am trying to use a COM component & activeX component in a WPF application. I am using these components via the background thread, so UI remains responsive. But the problem is I sometimes get a COM Exception while using these components. (not always)

Is this expected behavior or am I doing something wrong? Should I move the code to UI thread, but it ends up being time consuming.

thanks

Sandepku
  • 861
  • 14
  • 31
  • 1
    Please provide a full stack trace – Simon Mourier Jun 27 '14 at 07:22
  • @SimonMourier I can give only the following details System.Runtime.InteropServices.COMException (0x80004005) : COM error. additional methods are my class methods – Sandepku Jun 27 '14 at 08:30
  • > System.Threading.Tasks.Task.InnerInvoke() > System.Threading.Tasks.Task.Execute() – Sandepku Jun 27 '14 at 08:36
  • 1
    @Sandepku, most ActiveX controls need an STA thread with message pumping loop to function correctly. Check this: http://stackoverflow.com/questions/21211998/stataskscheduler-and-sta-thread-message-pumping – noseratio Jun 27 '14 at 08:48
  • @Noseratio thanks for the link, I agree with the answer, but, exception does not occur everytime. The chances of it happening are very less may be 1 out of 20 times. So I am wondering! – Sandepku Jun 27 '14 at 09:18

0 Answers0