This is my solution for a VSTO AddIn using WindowsForms.
You don't need any System.Windows.Forms.Control to use it:
Initialization in class ThisAddIn:
Add this line to "ThisAddIn_Startup" function:
this.TheWindowsFormsSynchronizationContext = WindowsFormsSynchronizationContext.Current
?? new WindowsFormsSynchronizationContext();
Add this new property:
public SynchronizationContext TheWindowsFormsSynchronizationContext { get; private set; }
Then the usage in the worker thread is:
Globals.ThisAddIn.TheWindowsFormsSynchronizationContext.Send(d =>
{
MyMethodToInvoke();
}, null);
A second solution (Not tested): You could maybe also use:
var invokerControl = new Control();
invokerControl.CreateControl(); //Forces the control handle to be created
invokerControl.Invoke(new MethodInvoker(MyMethodToInvoke));
Hope it helps, Jörg