none
Custom reading pane showing twice instead of once RRS feed

  • Question

  • I have as an add-in a customized reading pane as seen in attachment where it enables my users to copy and paste full addresses, but in my development of the add-in, the form region seems to be displaying twice instead of once, but can't seem to determine in my template code as to why this is happening.  Please advise on where I can check in order to properly fix this.
    Friday, November 9, 2012 6:15 PM

Answers

  • Is it possible the add-in is installed twice? Is it posible it is listed twice in HKLM and HKCU?

    What do you see in HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins and HKLM?

    Did you ever change the add-in name/GUID or location?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Saturday, November 10, 2012 4:49 AM

All replies

  • Can you put a breakpoint in your control's constructor? Does it get hit twice? What is the call stack?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Friday, November 9, 2012 6:29 PM
  •         public FormRegion1(Microsoft.Office.Interop.Outlook.FormRegion formRegion)
                : base(Globals.Factory, formRegion)
            {
                this.FormRegionShowing += new System.EventHandler(this.FormRegion1_FormRegionShowing);
                this.FormRegionClosed += new System.EventHandler(this.FormRegion1_FormRegionClosed);
            }

    I can at least see the following section get hit twice, not sure where I can find the "call stack"

    Friday, November 9, 2012 6:59 PM
  • Debug | Windows | Call Stack.

    Or hit Alt + 7.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Friday, November 9, 2012 7:05 PM
  • In looking at call stack for above code I can see the following 2 appear in call stack:

    CustomViewForContact.dll!CustomViewForContact.FormRegion1.FormRegion1(Microsoft.Office.Interop.Outlook.FormRegion formRegion) Line 22 C#

    [External Code]

      CustomViewForContact.dll!CustomViewForContact.FormRegion1.FormRegion1Factory.Microsoft.Office.Tools.Outlook.IFormRegionFactory.CreateFormRegion(Microsoft.Office.Interop.Outlook.FormRegion formRegion) Line 70 + 0x19 bytes C#

      Microsoft.Office.Tools.Outlook.Implementation.dll!Microsoft.Office.Tools.Outlook.FormRegionManagerImpl.Microsoft.Office.Interop.Outlook._FormRegionStartup.BeforeFormRegionShow(Microsoft.Office.Interop.Outlook.FormRegion outlookFormRegion) + 0xad bytes 

      [Native to Managed Transition] 

      [Native to Managed Transition] 

      [Appdomain Transition] 

    • Edited by jfalberg Friday, November 9, 2012 7:14 PM edit
    Friday, November 9, 2012 7:11 PM
  • How many times is your add-in loaded (ThisAddin class constructor)?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Friday, November 9, 2012 7:16 PM
  • As a com add-in seen in Outlook? or in my project?  If in Outlook, only once.  Otherwise I'm not sure where to find how many times it's loaded.
    • Edited by jfalberg Friday, November 9, 2012 7:25 PM
    Friday, November 9, 2012 7:24 PM
  • I mean how many times is the constructor of your add-in called under the debugger?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Saturday, November 10, 2012 12:03 AM
  • It appears to be called twice, not sure how. 

    Here's the source code from my FormRegion1.Designer.cs if this could show anything which appears to be where I am through debugger for the most part...

    namespace CustomViewForContact
    {
        partial class FormRegion1 : Microsoft.Office.Tools.Outlook.ImportedFormRegionBase
        {
            private Microsoft.Office.Interop.Outlook.OlkTextBox txtContactCard;
            private Microsoft.Office.Interop.Outlook._DRecipientControl _RecipientControl4;
            private Microsoft.Office.Interop.Outlook._DRecipientControl _RecipientControl3;
            private Microsoft.Office.Interop.Outlook._DRecipientControl _RecipientControl6;
            private Microsoft.Office.Interop.Outlook.OlkLabel label1;
            private Microsoft.Office.Interop.Outlook.OlkLabel olkLabel1;
            private Microsoft.Office.Interop.Outlook.OlkLabel olkLabel2;
            private Microsoft.Office.Interop.Outlook.OlkLabel phone1Label;
            private Microsoft.Office.Interop.Outlook.OlkTextBox phone1;
            private Microsoft.Office.Interop.Outlook.OlkLabel phone2Label;
            private Microsoft.Office.Interop.Outlook.OlkTextBox phone2;
            private Microsoft.Office.Interop.Outlook.OlkLabel phone4Label;
            private Microsoft.Office.Interop.Outlook.OlkTextBox phone4;
    
            public FormRegion1(Microsoft.Office.Interop.Outlook.FormRegion formRegion)
                : base(Globals.Factory, formRegion)
            {
                this.FormRegionShowing += new System.EventHandler(this.FormRegion1_FormRegionShowing);
                this.FormRegionClosed += new System.EventHandler(this.FormRegion1_FormRegionClosed);
            }
    
            protected override void InitializeControls()
            {
                this.txtContactCard = (Microsoft.Office.Interop.Outlook.OlkTextBox)GetFormRegionControl("txtContactCard");
                this._RecipientControl4 = (Microsoft.Office.Interop.Outlook._DRecipientControl)GetFormRegionControl("_RecipientControl4");
                this._RecipientControl3 = (Microsoft.Office.Interop.Outlook._DRecipientControl)GetFormRegionControl("_RecipientControl3");
                this._RecipientControl6 = (Microsoft.Office.Interop.Outlook._DRecipientControl)GetFormRegionControl("_RecipientControl6");
                this.label1 = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("Label1");
                this.olkLabel1 = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("OlkLabel1");
                this.olkLabel2 = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("OlkLabel2");
                this.phone1Label = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("Phone1Label");
                this.phone1 = (Microsoft.Office.Interop.Outlook.OlkTextBox)GetFormRegionControl("Phone1");
                this.phone2Label = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("Phone2Label");
                this.phone2 = (Microsoft.Office.Interop.Outlook.OlkTextBox)GetFormRegionControl("Phone2");
                this.phone4Label = (Microsoft.Office.Interop.Outlook.OlkLabel)GetFormRegionControl("Phone4Label");
                this.phone4 = (Microsoft.Office.Interop.Outlook.OlkTextBox)GetFormRegionControl("Phone4");
    
            }
    
            public partial class FormRegion1Factory : Microsoft.Office.Tools.Outlook.IFormRegionFactory
            {
                public event Microsoft.Office.Tools.Outlook.FormRegionInitializingEventHandler FormRegionInitializing;
    
                private Microsoft.Office.Tools.Outlook.FormRegionManifest _Manifest;
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                public FormRegion1Factory()
                {
                    this._Manifest = Globals.Factory.CreateFormRegionManifest();
                    this.InitializeManifest();
                    this.FormRegionInitializing += new Microsoft.Office.Tools.Outlook.FormRegionInitializingEventHandler(this.FormRegion1Factory_FormRegionInitializing);
                }
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                public Microsoft.Office.Tools.Outlook.FormRegionManifest Manifest
                {
                    get
                    {
                        return this._Manifest;
                    }
                }
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                Microsoft.Office.Tools.Outlook.IFormRegion Microsoft.Office.Tools.Outlook.IFormRegionFactory.CreateFormRegion(Microsoft.Office.Interop.Outlook.FormRegion formRegion)
                {
                    FormRegion1 form = new FormRegion1(formRegion);
                    form.Factory = this;
                    return form;
                }
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                byte[] Microsoft.Office.Tools.Outlook.IFormRegionFactory.GetFormRegionStorage(object outlookItem, Microsoft.Office.Interop.Outlook.OlFormRegionMode formRegionMode, Microsoft.Office.Interop.Outlook.OlFormRegionSize formRegionSize)
                {
                    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormRegion1));
                    return (byte[])resources.GetObject("RolodexView1");
                }
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                bool Microsoft.Office.Tools.Outlook.IFormRegionFactory.IsDisplayedForItem(object outlookItem, Microsoft.Office.Interop.Outlook.OlFormRegionMode formRegionMode, Microsoft.Office.Interop.Outlook.OlFormRegionSize formRegionSize)
                {
                    if (this.FormRegionInitializing != null)
                    {
                        Microsoft.Office.Tools.Outlook.FormRegionInitializingEventArgs cancelArgs = Globals.Factory.CreateFormRegionInitializingEventArgs(outlookItem, formRegionMode, formRegionSize, false);
                        this.FormRegionInitializing(this, cancelArgs);
                        return !cancelArgs.Cancel;
                    }
                    else
                    {
                        return true;
                    }
                }
    
                [System.Diagnostics.DebuggerNonUserCodeAttribute()]
                Microsoft.Office.Tools.Outlook.FormRegionKindConstants Microsoft.Office.Tools.Outlook.IFormRegionFactory.Kind
                {
                    get
                    {
                        return Microsoft.Office.Tools.Outlook.FormRegionKindConstants.Ofs;
                    }
                }
            }
        }
    
        partial class WindowFormRegionCollection
        {
            internal FormRegion1 FormRegion1
            {
                get
                {
                    foreach (var item in this)
                    {
                        if (item.GetType() == typeof(FormRegion1))
                            return (FormRegion1)item;
                    }
                    return null;
                }
            }
        }
    }
    

    Saturday, November 10, 2012 3:03 AM
  • Is it possible the add-in is installed twice? Is it posible it is listed twice in HKLM and HKCU?

    What do you see in HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins and HKLM?

    Did you ever change the add-in name/GUID or location?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Saturday, November 10, 2012 4:49 AM
  • add-in name/GUID or location?  Not sure.  This was on a new workstation also when we noticed it happening.

    While I only see it under HKCU (Current User), One thing I did notice when I went into my deployment setup for OfficeAddInSetup and went to view my registry setup, I have Registry on Target Machine setup under both HKEY_CURRENT_USER and User/Machine Hive for both Software/Microsoft/Office/Outlook/AddIns & FormRegions so I wonder if I have one that is unnecessary here.

    edit: as an update, I tried removing a copy from my Registry setup for the HKEY Current User, but it still didn't seem to shake off having a duplicate form, so much for that idea.


    • Edited by jfalberg Saturday, November 10, 2012 9:42 PM
    Saturday, November 10, 2012 2:13 PM
  • Does the addin get removed if you remove both the HKLM and HKCU registry keys?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Sunday, November 11, 2012 6:25 PM
  • The addin appears to get removed when I remove both the HKLM & HKCU registry keys.

    I went through Regedit again and noticed identicals existed in the following:

    HKLM\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\CustomViewForContact
    HKCU\Software\Microsoft\Office\Outlook\Addins\CustomViewForContact

    I'm not sure I understand the Wow6432Node part as I'm assuming it has to do with 64-bit.

    I went ahead and also did an uninstall and re-install.

    Now this is getting very interesting:  I notice the HKLM key is populated whereas the HKCU is not, and I now see one form region instead of 2, so I wonder if because in my deployment setup because I had identicals in both user hives & HKCU whether that caused my problem.  If removing the registry key for HKCU and an uninstall/reinstall did the trick then hopefully I'm good to go forward.

    Sunday, November 11, 2012 7:21 PM
  • Normally, only the HKLM key is set. If the current user does nto have the write access to the HKLM hive, then HKCU is used.

    I guess Outlook is not smart enough to realize that the same add-in is listed twice.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Monday, November 12, 2012 6:01 AM