none
Shared AddIns don't unload when disconnected? RRS feed

  • Question

  • We recently rewrote our AddIn in VB.NET (VS2010, .NET Runtime v4, not VSTO.) Since click-once deployment doesn't seem to be an option for shared AddIns we figured we'd re-use our live update scheme, which did not need to close Outlook in order to replace our VB6-built AddIn DLL. But we found that Outlook wasn't closing the new DLL file after it was disconnected.

    Typically this problem meant that some object reference wasn't being released, thus preventing the AddIn module from fully unloading. But after investigating that possibility at length without luck, I decided it was time for a reality check: I created a shared AddIn consisting only of the template code generated by VS2010 -- and found that even a do-nothing, reference-nothing AddIn DLL cannot be deleted after it's disconnected, Outlook must be closed before it is released.

    Is there really something inherent to shared .NET Outlook AddIns that makes it impossible to unload them by disconnecting?

     

    TIA,

    Mark McGinty

     

    Thursday, January 26, 2012 4:37 PM

Answers

  • P.S. You can call CoFreeUnusedLibraries, but obviously that cannot be done from the dll being unloaded. Something else must call that function in the outlook.exe process.
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    • Marked as answer by Mark McGinty Friday, January 27, 2012 1:49 AM
    Thursday, January 26, 2012 5:12 PM

All replies

  • COM add-ins are nothing more than ordinary in-proc COM servers. Even after the last COM object from an in-proc COM library is released, the COM system will keep the dll loaded for performance reasons for about 10 minutes.
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Thursday, January 26, 2012 4:52 PM
  • P.S. You can call CoFreeUnusedLibraries, but obviously that cannot be done from the dll being unloaded. Something else must call that function in the outlook.exe process.
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    • Marked as answer by Mark McGinty Friday, January 27, 2012 1:49 AM
    Thursday, January 26, 2012 5:12 PM
  • Ah I see, the VB6 component unloaded immediately because it was STA. 

    Thanks for the help, Dmitry, I appreciate it!  (btw, really like the new RDO tech ref pages, very nice!)  :-)

     

    -Mark

    Friday, January 27, 2012 3:19 AM