VSTO for Outlook - Floating Window Mind Boggling Bug RRS feed

  • Question

  • The code for this add in is available here. The videos demonstrating the behaviours are listed in the body of this explanation. Here are the two links for convenience Bug WorkAround

    I have been trying to write an Add In for Outlook 2010 and 2013 using Visual Studio 2013 however I have run into a very weird bug. These are the steps to reproduce this mind boggling bug which happens when the add in is installed in Outlook. The platform is Outlook 2010 on Windows 7 Enterprise

    1. Double click an email and opens it up in a new window (inspector window)
    2. In the TaskBar of Windows you would now notice a layered icon for Outlook. On mouseover Windows would show you the main outlook window and the opened up email (rendered in Aero theme if enabled)
    3. Simply go back and close the maximised email.
    4. Windows TaskBar still shows two layered icons as above but now if you mouse over the email window it shows nothing. It is like a ghost thing which isn't cleaned up.

    The best way I could demonstrate this was by recording a small video which is available here

    This however is not the end of story. It gets better and interesting. Now do this.

    1. Restart Outlook
    2. Maximise an email again as earlier.
    3. Mouse over the icon in the task bar to bring over the two layered window thing. You can close the maximised window from here too. Go ahead and do that.
    4. This time as you can see the window for the email is properly gone! The task bar is now showing a single icon for Outlook.

    To illustrate this behaviour I recorded another video which is available here.

    A few points to note about this behaviour

    1. This happens only on Outlook 2010. With Outlook 2013 this behaviour does not show up.
    2. I have narrowed this down to one line of code. In the OutlookExplorerWrapper if the following line is commented the behaviour disappears from Outlook 2010

      var s = mail.Body;

    Essentially simply accessing the Body property on the MailItem object leads to this behaviour. I have swapped Body with RTFBody which again makes the bug disappear.

    I am truly at my wits end here. Any help is much much appreciated!

    • Edited by nik.net3 Monday, December 22, 2014 5:10 AM
    Monday, December 22, 2014 5:10 AM