Setting addin to be single threaded

Add-in Express™ Support Service
That's what is more important than anything else

Setting addin to be single threaded
Matt Driver


Posts: 152
Joined: 2004-08-17

I am interfacing my Outlook add-in using various interop's that require the calling program to be single threaded so usually I do this:

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
Application.Run(new Form1());

Where should I put the [STAThread] line in my ADX add-in so make it single threaded ?

Is this ok and supported ?


Posted 19 Jun, 2006 06:12:16 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi Matt.

The fact is that Office COM add-ins are Inproce servers that are loaded to the process of host application. You can't change the Threading Model for COM add-ins. However you can use the 'lock' keyword to mark a statement block as a critical section in the add-in code.
Posted 19 Jun, 2006 06:53:29 Top