ThreadState Exception when starting Outlook Addin in Office 2000

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

ThreadState Exception when starting Outlook Addin in Office 2000
 
Mike M.




Posts: 31
Joined: 2006-11-13
I use ADX 2007 and .Net 2.0. My add-in installs fine on Windows XP Outlook 2003, but when I tried intalling it on a win 2k pc with Outlook 2000, a ThreadState exception was thrown during installation.

I use the default setup project generated by ADX.

Apparently the exception is thrown during Addin start up when my Addin
attempts to set the AutoCompleteMode to 'SuggestAppend',on a combobox which is used inside a .Net usercontrol that is shown on the toolbar of the Outlook explorer window.

The exception also says that the current thread must be set to single thread appartment, by using STAThreadAttribute on the main function. Where would that be in an ADX Outlook Add-in?

I have noted another topic in this forum regarding this exception, where the problem was that drag drop was enabled. I will also need drag drop enabled to form regions in my Outlook Add-in, but is there any problems with using drag/drop to outlook regions / panes?

Any ideas about how to fix this?
Posted 06 Feb, 2007 08:11:16 Top
Sergey Grischenko


Add-in Express team


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

Did you add any custom code to the addinmodule constructor?


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 06 Feb, 2007 09:48:06 Top
Mike M.




Posts: 31
Joined: 2006-11-13
yes, after the call to InitializeComponent. From the stack trace in the exception, I can see that exception is thrown during InitializeComponent of the addin module, which in turn calls the InitializeComponent of the user control which then fails when it attempts to initialise the combobox:

Here is an attempt to include a screenshot of the stack trace:
[img]file:///D:/Untitled.png[/img]

Other wise my addin moudule constructor only hooks up some events like this (works fine in OL 2003):


        public AddinView()
        {
            try
            {
                InitializeComponent();
                HookupApplicationLevelEvents();
            }
            catch(Exception e)
            {
                MessageBox.Show(e.ToString(), T.ExUnhandledExceptionDuringStartup);
                CloseLog();
                throw;
            }
        }

        private void HookupApplicationLevelEvents()
        {
            if(Log.HasLevel(Level.Debug)) Log.Debug("Hooking up Application Level Events");
            OnError += new ADXError_EventHandler(AddinViewOnError);
            AddinBeginShutdown += new ADXEvents_EventHandler(HandleBeginShutdown);
            AddinInitialize += new ADXEvents_EventHandler(AddinView_AddinInitialize);
            AddinStartupComplete += delegate(object sender, EventArgs e)
                                    {
                                        if (Log.HasLevel(Level.Debug)) Log.Debug("Addin Startup completed. Proceeding with initialization.");
                                        if (Log.HasLevel(Level.Debug)) Log.Debug("Creating Addin controller.");
                                        HookUpEvents();
                                    };
        }
Posted 06 Feb, 2007 11:06:18 Top
Mike M.




Posts: 31
Joined: 2006-11-13
ok, I will mail you the screen shot then.

What about my concerns about drag drop that I asked in my prev. post.

Best regards Mike.
Posted 06 Feb, 2007 11:08:00 Top
Sergey Grischenko


Add-in Express team


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

Please try to initialize combo boxes in the AddinInitialize event handler.
Let me know if it doesn't help.

What about my concerns about drag drop that I asked in my prev. post.

The 'ADX Extensions for Outlook' product has no problems with the drag-drop functionality.
Posted 07 Feb, 2007 08:19:49 Top