Visual Studio 即时调试器,如何选择当前 运行 实例?

Visual Studio Just-In-Time debugger, how to choose current running instance?

当您的程序断言时,JIT 会弹出并询问您是否要关闭或调试该程序。 选择调试后,需要确认是,调试。 然后,您需要从列表中选择一个 visual studio,这很可能是当前的 运行 实例。 你如何使这个过程自动化?

我使用了 AutoHotKey:

; Auto-click jit debug pop-up. Run the script as admin. 
Loop,
{
    WinWait, Visual Studio Just-In-Time Debugger
    IfWinExist, Visual Studio Just-In-Time Debugger
    {
        ;MsgBox, here
        WinActivate, Visual Studio Just-In-Time Debugger

        ; click the yes button
        SetControlDelay -1
        ControlClick, Button1

        ; choose instance from the list
        WinWait, Choose Just-In-Time Debugger
        WinActivate, Choose Just-In-Time Debugger
        ;ControlGet, lb1, Hwnd, , ListBox1
        ;msgbox, %lb1%
        ControlGet, items, List, , ListBox1
        Loop, Parse, items, `n
        {
            ;MsgBox, Item number %A_Index% is %A_LoopField%.
            IfInString, A_LoopField, administrator 
            {
                ;MsgBox, found
                Control, ChooseString, %A_LoopField%, ListBox1
                break
            }
        }

    }    
}

在列表框中,我正在寻找包含子字符串 'administrator' 的项目,但您可以更改它。