locked
VS 2010 (debuggee) hangs up after debugging Add-In RRS feed

  • Question

  • Hi,

    this is a question about debugging Add-Ins with Visual Studio 2010.

    I have configured devenv.exe as the 'external program' to be started to debug my Add-In. If I simply start Visual Studio 2010 in the debugger, and then close it immediately everything works fine. VS 2010 - the debuggee - terminates and the debugger (also VS 2010) switches back to edit mode.

    However, if I simply start my Add-In in VS 2010 (the debuggee) and then close the application, the main window closes, but the application hangs up. The debugger does not switch back to edit mode, unless I actively terminate the application.

    If I break the execution and look at the threads window, I see that:

    * the main thread indicates [In a sleep, wait, or join]

    * there is 'GC Finalizer Thread' at the location Microsoft.Internal.VisualStudio.PlatformUI.DataSource.UnsubscribeInnerSourcePropertyChangeEvents()

    The OnDisconnection event in my Add-In has been executed.

    Visual Studio 10 does not hang up on termination if I start it without the debugger, even if I use my Add-In.

    Does anybody know what is happening? Am I failing to do some cleaning operations in the OnDisconnection event handler? Why is the behaviour different in the debugger, compared to running the program normally?

    Best regards

    Phil

    Thursday, May 6, 2010 9:59 PM

Answers

  • Hi Chao,

    thanks for your response. I have now found the code which generated the error, by skipping parts of the initialization of my Add-In until I had narrowed it down.

    I originally created my Add-In with Visual Studio 2002 and some of the startup code is not much changed since then.

    I had been fetching a reference to the Tools menu directly from the top level _applicationObject.CommandBars object. In addition, I had declared it as a CommandBar and not a CommandBarPopup class. I have now modified the code to first fetch the MenuBar object, and then the Tools menu as a CommandBarPopup. (I generated a new Add-In with the wizard and looked at how it did it.)

    That seems to fix the problem, although I have no idea why!

    Best regards
    Phil

    • Marked as answer by Chao Kuo Thursday, May 13, 2010 6:00 AM
    Wednesday, May 12, 2010 8:54 PM

All replies

  • Hello, Phil

    I have tried to reproduce your issue, but does not success. After I terminate the debuggee, the visual studio only hangs up for a few seconds, the it returned to edit mode.

    I guess maybe you add-in cause this issue, could you post the simplified code about your add-in?

    Thanks

    Chao

    Tuesday, May 11, 2010 9:02 AM
  • Hi Chao,

    thanks for your response. I have now found the code which generated the error, by skipping parts of the initialization of my Add-In until I had narrowed it down.

    I originally created my Add-In with Visual Studio 2002 and some of the startup code is not much changed since then.

    I had been fetching a reference to the Tools menu directly from the top level _applicationObject.CommandBars object. In addition, I had declared it as a CommandBar and not a CommandBarPopup class. I have now modified the code to first fetch the MenuBar object, and then the Tools menu as a CommandBarPopup. (I generated a new Add-In with the wizard and looked at how it did it.)

    That seems to fix the problem, although I have no idea why!

    Best regards
    Phil

    • Marked as answer by Chao Kuo Thursday, May 13, 2010 6:00 AM
    Wednesday, May 12, 2010 8:54 PM
  • Good to hear that your problem was resolved, And I close this thread.

    Thanks

    Chao

    Thursday, May 13, 2010 6:00 AM