Problem with COM Reference Counter

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

Problem with COM Reference Counter
 
nicograf




Posts: 7
Joined: 2015-06-22
Hello,

i have a little Problem with the Outlook Explorer Reference Counter. When we initialize the form manager

AddinExpress.OL.ADXOlFormsManager.CurrentInstance.Initialize(this);

every time when i switch to the Backstage Area and back the reference counter of the Explorer COM-Object
is increased by one.

Here is my minimal VSTO-Addin to reproduce the problem.


public partial class ThisAddIn
    {
        private Outlook.Explorer exp;
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            exp = Application.ActiveExplorer();
            ((Outlook.ApplicationEvents_11_Event)Application).Quit
+= new Outlook.ApplicationEvents_11_QuitEventHandler(ThisAddIn_Quit);

            AddinExpress.OL.ADXOlFormsManager.CurrentInstance.Initialize(this);


        }
        void ThisAddIn_Quit()
        {
            System.Diagnostics.Debug.WriteLine(Marshal.ReleaseComObject(exp));
            AddinExpress.OL.ADXOlFormsManager.CurrentInstance.Finalize(this);
        }
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            // Note: Outlook no longer raises this event. If you have code that 
            //    must run when Outlook shuts down, see http://go.microsoft.com/fwlink/?LinkId=506785
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }


We have Outlook 2016. Without Addin Express, the reference counter is null on shutdown.

Regards

Nico
Posted 14 Sep, 2016 02:26:27 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Thank you Nico for pointing us to this issue!

We've fixed it. If you wish I can send you an assembly that fixes this issue.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Sep, 2016 08:41:57 Top
nicograf




Posts: 7
Joined: 2015-06-22
Hi Andrei,

it would be nice if you can send me the fixed assembly.

Thanks.

Regards

Nico
Posted 15 Sep, 2016 00:41:24 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Nico,

In a minute I'll send you an email with a download link for the assembly that fixes the issue.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2016 09:13:30 Top
nicograf




Posts: 7
Joined: 2015-06-22
Hello Andrei,

the assembly solves the Problem with the reference counter.

Thanks.

Regards

Nico
Posted 19 Sep, 2016 00:57:35 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Thanks a lot for confirming!


Andrei Smolin
Add-in Express Team Leader
Posted 19 Sep, 2016 03:07:52 Top