Outlook 2003 with multiple explorers won't shutdown

T

Teodora Gancheva

Hi,

I am developing a C# COM add-in for Outlook 2003 and 2007.
Recently the need for supporting multiple Outlook explorers arised and I am
currently implementing that. I used Ken Slovak's Outlook project
CSAddinTemplate as a sample - many thanks for the great template and all the
guidance in developing COM add-ins for Office :).
All is working fine for Outlook 2007, but in Outlook 2003 (it's SP3) when I
start multiple explorers and then close them one by one, Outlook process
won't shutdown (OnDisconnection does not even get called). If I only have one
Outlook explorer, the process exits nicely.
I thought I had forgotten to release any references to Outlook objects, so I
disabled my add-in from the registry and left only the CSAddinTemplate to
load - this again led Outlook to not shut down. If I disable all add-ins,
Outlook closes without any issues. Also if I use File->Exit, and not the X
button, Outlook shuts down nicely, no matter if I have add-ins loaded and how
many explorers are opened.

Have you ever encountered such issues with Outlook 2003 - is it a bug or do
I need to re-check the code for unreleased references?
Many thanks for all ideas and comments,
Teodora Gancheva
 
K

Ken Slovak - [MVP - Outlook]

Check things again and then if you still have problems post here, and I'll
see what's going on.

FWIW I haven't had any problems with Outlook 2003, although the timing of
things in the template was adjusted for Outlook 2007.

A lot of work was done by MS for Outlook 2007 to fix the OnDisconnection()
not firing bug, it's possible things aren't optimized for 2003 in the
published template. I use a highly modified version of that template myself
for my own code.
 
T

Teodora Gancheva

For anyone that could encounter the same issue, here's what resolved the
problem in my case.
I have a private variable of type Explorer in the ExplorerWrapper class to
keep a reference to the Outlook Explorer object. In the Close event of the
Explorer I was assigning null to the Explorer variable, but this seems to not
have been enough. I added Marshal.FinalReleaseComObject(this.explorer), and
now Outlook is successfully shutting down.
Regards,
Teodora Gancheva
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top