locked
Restart Debug Button Disabled RRS feed

  • Question

  • We have implemented our own custom debugger and got it pretty well working... We can run and start the debugger, step through the code, etc.   We are now trying to get the Debug > Restart functionality working but the Restart button and menu item are showing up disabled.   Not sure what we are doing wrong.. was hoping someone might point me in the right direction to have these items show up enabled.  

    Thanks in advance..

    Dave

    Wednesday, December 5, 2012 2:21 PM

Answers

  • The code in the debugger that appears to handle this is doing this:

    fEnableCommand = (fShowCommand
                      && pDebugger->CanLaunch()
                      && pDebugger->LaunchedSession()
                      && !pDebugger->InAutomationEventHandler()
                      && !pDebugger->InApplyCodeChanges()
                      && !pDebugger->IsDebuggingBeingStopped());

    fShowCommand is based on whether or not the shell is in debug mode currently (can't restart debugging while in design mode).

    CanLaunch looks, somewhat complicated, and I have no idea what a custom debugger entails. It looks like it will ask the solution if debugging can start, which will first ask the selected project and then, if that failed, ask the startup project. Assuming that succeeds we move on to LaunchedSession. That call just seems to check an internal field on the debugger that says this:

    bool m_fLaunchedSession; // launched session as opposed to attach to app (relevant for enabling restart)

    so I assume this means your debug engine must have been used to launch the app and not attach to an already running app. Assuming that passes we move on to InAutomationEventHandler, which looks like this

    bool InAutomationEventHandler()
    {
        return m_fFiringAutomationModeChangeEvent
               || m_fFiringAutomationContextChangeEvent;
    }

    I suspect that should only be true if the debugger is dispatching an outbound automation event, which likely isn't true in your case.  InApplyCodeChanges seems to check if we are involved in an Edit and Continue scenario. That leaves only IsDebuggingBeingStopped, which is another internal field check which just says 'stop debugging is currently in progress'.

    If none of that helps I would need to try and wrangle a debugger dev to lend some insight, as I have 0 insight into what a custom debug engine does to integrate with VS.

    Ryan

    • Marked as answer by Ego Jiang Thursday, December 13, 2012 5:14 AM
    Thursday, December 6, 2012 1:41 AM