locked
ext_ConnectMode.ext_cm_UISetup firing every time an AddIn is loaded (not in debugger) RRS feed

  • Question

  • I'm running VS2010 on Windows 7.

    I've been creating an Add In following the MZTools articles and I've run into a problem. The ext_ConnectMode.ext_cm_UISetup is being sent to the OnConnection method of my AddIn every time VS loads. I am not running in the debugger so /resetaddin <MyAddIn>.Connect is not getting called.

    I figured I must've nubbed something up in my code so I created a brand new AddIn solution, and added a MessageBox.Show in the OnConnect when I receive ext_ConnectMode.ext_cm_UISetup. It is getting called everytime Visual Studio loads. The load settings in the .AddIn file are:

    <LoadBehavior>1</LoadBehavior>
    <CommandPreload>1</CommandPreload>
    <CommandLineSafe>0</CommandLineSafe>

    The .AddIn file is located in my \Documents\Visual Studio 2010\Addins folder.

    What am I missing? Is there a way to properly install the AddIn? From what I've read, installing the AddIn is just having the .AddIn file in said folder and having it point to the AddIn's DLL.

    I'm stumped...

    Friday, March 15, 2013 9:15 PM

Answers

  • Given an add-in whose .AddIn file has <CommandPreload>1</CommandPreload>, Visual Studio knows whether ext_ConnectMode.ext_cm_UISetup has been fired already or not for the current user through the following registry entry:

    Key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\PreloadAddinStateManaged

    Name: the add-in name and .AddIn file path

    Value:

    • 1: indicates that the ext_cm_UISetup flag will be used for that add-in the next time that Visual Studio .NET is launched.
    • 2: indicates that the flag was already used.

    So, after ext_ConnectMode.ext_cm_UISetup is fired, use regedit.exe to check that the value has changed to 2 (it should).

    See:

    HOWTO: Reset a Visual Studio add-in
    http://www.mztools.com/articles/2006/mz2006014.aspx


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/


    Saturday, March 16, 2013 9:55 PM

All replies

  • Given an add-in whose .AddIn file has <CommandPreload>1</CommandPreload>, Visual Studio knows whether ext_ConnectMode.ext_cm_UISetup has been fired already or not for the current user through the following registry entry:

    Key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\PreloadAddinStateManaged

    Name: the add-in name and .AddIn file path

    Value:

    • 1: indicates that the ext_cm_UISetup flag will be used for that add-in the next time that Visual Studio .NET is launched.
    • 2: indicates that the flag was already used.

    So, after ext_ConnectMode.ext_cm_UISetup is fired, use regedit.exe to check that the value has changed to 2 (it should).

    See:

    HOWTO: Reset a Visual Studio add-in
    http://www.mztools.com/articles/2006/mz2006014.aspx


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/


    Saturday, March 16, 2013 9:55 PM
  • That registry key is set and is 2. However, ext_cm_UISetup is still fired every time VS starts up. Here's the interesting bit: this only happens on my work computer which definitely has group/domain policies that I'm guessing are interfering somehow. On my personal machine the message correctly gets fired once, as stated in the documentation and your articles.
    Saturday, March 30, 2013 4:54 PM
  • Hi,

    Can you use Process Monitor (from Sysinternals / TechNet) to monitor the accesses of VS to that registry key? If for whatever reason it can't read the value, it will fire ext_cm_UISetup each time.


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/

    Sunday, March 31, 2013 11:05 PM
  • Ok, finally had a chance to run process monitor on both. For whatever reason, on my work machine, visual studio always deletes the key on startup. 

    Here are my procmon files:

    https://dl.dropbox.com/u/5949903/procmon/procmon_vsaddins_fail_work_machine.CSV

    https://dl.dropbox.com/u/5949903/procmon/procmon_vsaddins_success_personal_machine.CSV

    Saturday, April 6, 2013 9:42 PM
  • Well, that explains why you get a ext_ConnectMode.ext_cm_UISetup each time that you load VS.

    Now the question is why that registry key is deleted. The only reason that I know is that VS is launched with the /resetaddin command line flag, either from the VS instance with the source code, or from a shortcut that has that command line flag as part of the target.

    Can you try launching VS without a shortcut, that is, double clicking the devenv.exe file?


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/

    Monday, April 8, 2013 8:50 AM