The Outlook shutdown problem occurs when there are unreleased references to Outlook objects in a COM add-in (implementing IDTExtensibility2) when the application is closed. Because there are still references to Outlook objects, the OnDisconnection method never gets called and Outlook doesn't get closed properly. Even though the Outlook user interface might not be visible, Outlook is still running (Outlook.exe is a process still running in the Windows Task Manager).
VSTO helps address this issue by keeping track of the number of Inspectors and Explorers that are opened and closed. When no more windows are open in Outlook, it indicates that Outlook has closed, and VSTO ensures that Outlook is shut down properly. It does this by unloading the application domain in which the add-ins were loaded and releasing any references to COM objects. Note, however, that issues with shutdown might still occur if you are automating Outlook and you create a running instance of Outlook without making it visible or opening any of its windows (the Inspectors and Explorers are never opened, so VSTO cannot track them).
Was this article helpful?