I am developing an application level VSTO 4 Addin for Microsoft Excel 2007 / 2010. The result is a windows forms based DLL using .Net 4 Client Profile.
Now I have to use a legacy COM-DLL. It is no problem to set the reference and access the COM-Methods via COM-Interop from .Net.
But the the (synchronous) method I need to call can take a minute or longer to get back.
I know your answer: Use a worker thread...
I have used The Task Parallel Library to put the long lasting operation in a worker task and keep the GUI (Excel) responding.
But: The inprocess COM-Call (in the worker task/thread) still seems to block my GUI-Thread.
- Why? Is it because Excel is always running as STA (Single Thread Apartment)?
- How can I keep the Excel GUI responding?
- Is there a way to make it really asynchronous?
Thanks for any answers,
Jörg