使用宏或键盘快捷键切换“抛出异常时中断”

时间:2023-01-15 00:16:57

Edit: Visual Studio 2015's new exception window is so much faster than the old dialog that I no longer care as much about using a keyboard shortcut for it.

编辑:Visual Studio 2015的新异常窗口比旧对话框快得多,我不再关心使用它的键盘快捷方式。

Is there a macro or keyboard shortcut that will toggle "break when an exception is thrown" without using the GUI?

是否有一个宏或键盘快捷方式,可以在不使用GUI的情况下切换“在抛出异常时中断”?

Opening the dialog with ctrl+alt+e and checking the "Common Language Runtime Exceptions" "Thrown" box then clicking OK is simple enough, but this is something I do a lot. I would rather have a keyboard shortcut for this.

使用ctrl + alt + e打开对话框并检查“公共语言运行时异常”“抛出”框然后单击“确定”很简单,但这是我做了很多事情。我宁愿有一个键盘快捷方式。

This question is a duplicate of Any have a Visual Studio shortcut/macro for toggling break on handled/unhandled exceptions?

这个问题是Any的副本有一个Visual Studio快捷方式/宏来切换处理/未处理异常的中断?

However, the poster accepted an answer that doesn't really work, and I would really like an answer that does work.

然而,海报接受了一个不起作用的答案,我真的想要一个有效的答案。

The answer in the duplicate question is not acceptable because it toggles only one specific exception, not the entire CLR group.

重复问题中的答案是不可接受的,因为它只切换一个特定的异常,而不是整个CLR组。

"Well write a loop then." you say. But not so fast! Someone tried that already and it was uselessly slow. (Yes I've verified that its slow on my system as well.)

“好吧,然后写一个循环。”你说。但不是那么快!有人尝试过这一点,而且它无用缓慢。 (是的,我已经证实它在我的系统上也很慢。)

So the challenge is to use a macro to toggle the entire CLR Exceptions category in less than 1 or 2 seconds. This question is a duplicate of Any have a Visual Studio shortcut/macro for toggling break on handled/unhandled exceptions?

因此,挑战在于使用宏来在不到1秒或2秒的时间内切换整个CLR例外类别。这个问题是Any的副本有一个Visual Studio快捷方式/宏来切换处理/未处理异常的中断?

10 个解决方案

#1


I have created a free Visual Studio extension that can do that reliably: Exception Breaker.
It uses undocumented IDebugSession2.SetException call that is very fast: all exceptions are set/unset in 20 to 60 milliseconds.

我创建了一个可以可靠地执行此操作的免费Visual Studio扩展:Exception Breaker。它使用非快速的未记录的IDebugSession2.SetException调用:所有异常都在20到60毫秒内设置/取消设置。

#2


Very similar to the other answer, but there is a special ExceptionSetting for the group.

与其他答案非常相似,但该组有一个特殊的ExceptionSetting。

Dim dbg As EnvDTE90.Debugger3 = DTE.Debugger
Dim exSettings As EnvDTE90.ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
Dim exSetting As EnvDTE90.ExceptionSetting
Try
    exSetting = exSettings.Item("Common Language Runtime Exceptions")
Catch ex As COMException
    If ex.ErrorCode = -2147352565 Then
        exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
    End If
End Try

If exSetting.BreakWhenThrown Then
    exSettings.SetBreakWhenThrown(False, exSetting)
Else
    exSettings.SetBreakWhenThrown(True, exSetting)
End If

#3


Here's Bryce Kahle's very useful macro blindly updated to run in VS2010:

这是Bryce Kahle非常有用的宏,盲目更新以在VS2010中运行:

Sub ToggleExceptions()
    Dim dbg As EnvDTE100.Debugger5 = DTE.Debugger
    Dim exSettings As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
    Dim exSetting As ExceptionSetting
    Try
        exSetting = exSettings.Item("Common Language Runtime Exceptions")
    Catch ex As COMException
        If ex.ErrorCode = -2147352565 Then
            exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
        End If
    End Try

    If exSetting.BreakWhenThrown Then
        exSettings.SetBreakWhenThrown(False, exSetting)
    Else
        exSettings.SetBreakWhenThrown(True, exSetting)
    End If

End Sub

#4


First i initalized a timer an then i call the command Exception.Debug. The timer hit, when the modal dialog is openend. If you use Win 7 with deactivated UAC SendKeys with ALT-Key will fail...i don't know why.

首先我将一个计时器初始化,然后我调用命令Exception.Debug。当模态对话框打开时,计时器命中。如果你使用Win 7与停用的UAC SendKeys与ALT-Key将失败...我不知道为什么。

i played a little bit...try this (VS2010 EN):

我玩了一下......试试这个(VS2010 EN):

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Runtime.InteropServices

'...

Private WithEvents t As Timers.Timer
Private Sub t_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles t.Elapsed
    t.Stop()
    ' Tastatureingaben simulieren
    System.Windows.Forms.SendKeys.SendWait("{DOWN}")
    System.Threading.Thread.Sleep(1500) ' Pause wichtig zum Laden des Exceptionbaums
    System.Windows.Forms.SendKeys.SendWait("%t")
    System.Windows.Forms.SendKeys.SendWait("{ENTER}")
End Sub
Public Sub toggleCLRExceptions()
    If DTE.Solution.Count <= 0 Then
        MsgBox("Nicht ohne geöffnete Solution!")
        Exit Sub
    End If
    ' Timer wird benötigt, da der Dialog Modal ist
    ' und weitere Befehle im Macro werden erst nach beenden des Dialogs ausgeführt
    t = New Timers.Timer()
    t.Interval = 0.5
    t.Start()
    DTE.ExecuteCommand("Debug.Exceptions")
    'System.Windows.Forms.SendKeys.SendWait("^%e") ' alternativ: STRG+ALT+e
    System.Threading.Thread.Sleep(200)
    If isCLRExceptionsActive() Then
        MsgBox("BREAK @CLR-Exception", MsgBoxStyle.Information, "Info")
    Else
        MsgBox("NO BREAK @CLR-Exception", MsgBoxStyle.Information, "Info")
    End If
End Sub

Function isCLRExceptionsActive() As Boolean
    ' prüft, ob Setting Debug CLR-Exceptions aktiviert/deaktivert ist
    Dim dbg As EnvDTE100.Debugger5 = DTE.Debugger
    Dim exSettings As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
    Dim exSetting As ExceptionSetting
    Try
        exSetting = exSettings.Item("Common Language Runtime Exceptions")
    Catch ex As COMException
        If ex.ErrorCode = -2147352565 Then
            exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
        End If
    End Try
    Return exSetting.BreakWhenThrown
End Function

'...

#5


Well, I wrote a VS2008 C# based plug-in that toggles the 386 exceptions, and it takes about 1 second per state toggle. I'm assuming that's due to COM inter-op.

好吧,我写了一个基于VS2008 C#的插件,可以切换386个异常,每个状态切换大约需要1秒。我假设这是由于COM互操作。

This was based on the VB/macro code in the one of your links. I could not find an easier C++ method (but not ruling it out).

这是基于您的一个链接中的VB /宏代码。我找不到更简单的C ++方法(但不能排除它)。

The next level would be to make a plug-in that has a keyboard binding, that then opens the Exceptions UI and then "clicks" the correct tick box for you.

下一个级别是制作一个具有键盘绑定的插件,然后打开Exceptions UI,然后为您“点击”正确的复选框。

Good luck.

#6


You could use a tool like AutoHotKey to create a recorded script (mouse clicks or key presses) and then assign it a hotkey that will play it back when pressed...

您可以使用AutoHotKey之类的工具创建录制的脚本(鼠标点击或按键),然后为其分配一个热键,按下后将播放该热键...

#7


Just offering some info I found on this (here) as I was scouring the net in my futile attempt to help...

只是提供我在这里(这里)发现的一些信息,因为我在网上搜索我的徒劳尝试...

Someone else posed this same question and it was responded to by Gary Chang from MS Support, here's the quoted response:

其他人提出了同样的问题,来自MS Support的Gary Chang回应了这里引用的回复:

I am afraid the Macro code cannot manipulate the operations on the Exceptions dialog box...

我担心宏代码无法操纵“例外”对话框中的操作...

It's important to note that this posting is from December of 2005 so this response may no longer be accurate; either way, thought I'd throw it out there.

重要的是要注意这个帖子是从2005年12月开始的,所以这个回复可能不再准确;不管怎样,以为我会把它扔出去。

#8


The suggestion of setting the special ExceptionSetting for the group does indeed toggle the state of the top-level checkbox. However, it doesn't seem to toggle the individual Exceptions below it in the tree, and moreover, my process does not stop when such exceptions are thrown as it does if I manually check the top-level checkbox. Do you see different behavior?

为组设置特殊ExceptionSetting的建议确实切换了*复选框的状态。但是,它似乎没有在树中切换它下面的单个异常,而且,当我手动检查*复选框时,抛出此类异常时我的进程不会停止。你看到不同的行为吗?

#9


My macro to ignore current CLR exception in runtime. It works like a button 'disable catching this exception type' when an exception pops at debug-time.

我的宏在运行时忽略当前的CLR异常。当调试时弹出异常时,它就像一个按钮'禁用捕获此异常类型'。

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.ControlChars

' execute Macros.MyMacros.VSDebuggerExceptions.IgnoreCurrentExceptionWhenThrown from VS Command Window

Public Module VSDebuggerExceptions

    Sub BreakWhenThrown(Optional ByVal strException As String = "")
        Dim dbg As Debugger3 = DTE.Debugger
        Dim eg As ExceptionSettings = _
            dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
        eg.SetBreakWhenThrown(True, eg.Item(strException))
    End Sub

    ' copied from Utilities module (samples)
    Function GetOutputWindowPane(ByVal Name As String, Optional ByVal show As Boolean = True) As OutputWindowPane
        Dim window As Window
        Dim outputWindow As OutputWindow
        Dim outputWindowPane As OutputWindowPane

        window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
        If show Then window.Visible = True
        outputWindow = window.Object
        Try
            outputWindowPane = outputWindow.OutputWindowPanes.Item(Name)
        Catch e As System.Exception
            outputWindowPane = outputWindow.OutputWindowPanes.Add(Name)
        End Try
        outputWindowPane.Activate()
        Return outputWindowPane
    End Function

    Private WithEvents t As Timers.Timer

    ' Adds the current exception to ignore list
    Sub IgnoreCurrentExceptionWhenThrown()
        Dim commandWin As EnvDTE.CommandWindow
        commandWin = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow).Object

        Select Case DTE.Debugger.CurrentMode
            Case dbgDebugMode.dbgDesignMode
                commandWin.OutputString("This macro is not enabled in Design Mode. Run it in Break Mode." + vbCrLf)
                Return

            Case dbgDebugMode.dbgRunMode
                commandWin.OutputString("This macro is not enabled in Run Mode. Run it in Break Mode." + vbCrLf)
                Return
        End Select

        commandWin.OutputString(Environment.NewLine)
        commandWin.OutputString("Trying to get the information about current exception.." + Environment.NewLine)

        Dim dbg As Debugger3 = DTE.Debugger
        Dim currentExpression As Expression = dbg.GetExpression("$exception", False)
        Try    
            Dim currentExceptionTypeString As String = currentExpression.DataMembers.Item(1).Type
            commandWin.OutputString("Detected current exception type is : " + currentExceptionTypeString + Environment.NewLine)

            Dim flag As Boolean = True
            Dim eg As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
            Try
                eg.SetBreakWhenThrown(False, eg.Item(currentExceptionTypeString))
            Catch exc As Exception
                commandWin.OutputString("Cannot find this exception, trying to create.." + currentExceptionTypeString + Environment.NewLine)
                '
                eg.NewException(currentExceptionTypeString, New Random().Next)
                eg.SetBreakWhenThrown(False, eg.Item(currentExceptionTypeString))
                eg.SetBreakWhenUserUnhandled(True, eg.Item(currentExceptionTypeString))
                flag = False
            End Try

            commandWin.OutputString(Environment.NewLine)
            commandWin.OutputString("Exception '" + currentExceptionTypeString + "' added to ignore list.")
            commandWin.OutputString(Environment.NewLine)

            t = New Timers.Timer()
            ' small interval to send keys after DTE will start to exec command
            t.Interval = 0.1
            t.Start()
            DTE.ExecuteCommand("Debug.Exceptions")

        Catch exc As Exception
            commandWin.OutputString("Error occured")
        End Try
    End Sub

    Private Sub t_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles t.Elapsed
        t.Stop()
        ' only press Ok to apply changed exceptions settings to debugger
        System.Windows.Forms.SendKeys.SendWait("%t")
        System.Windows.Forms.SendKeys.SendWait("{ENTER}")
    End Sub

End Module

#10


CTRL + ALT + E ALT + T Enter

CTRL + ALT + E ALT + T输入

works for me

适合我

#1


I have created a free Visual Studio extension that can do that reliably: Exception Breaker.
It uses undocumented IDebugSession2.SetException call that is very fast: all exceptions are set/unset in 20 to 60 milliseconds.

我创建了一个可以可靠地执行此操作的免费Visual Studio扩展:Exception Breaker。它使用非快速的未记录的IDebugSession2.SetException调用:所有异常都在20到60毫秒内设置/取消设置。

#2


Very similar to the other answer, but there is a special ExceptionSetting for the group.

与其他答案非常相似,但该组有一个特殊的ExceptionSetting。

Dim dbg As EnvDTE90.Debugger3 = DTE.Debugger
Dim exSettings As EnvDTE90.ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
Dim exSetting As EnvDTE90.ExceptionSetting
Try
    exSetting = exSettings.Item("Common Language Runtime Exceptions")
Catch ex As COMException
    If ex.ErrorCode = -2147352565 Then
        exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
    End If
End Try

If exSetting.BreakWhenThrown Then
    exSettings.SetBreakWhenThrown(False, exSetting)
Else
    exSettings.SetBreakWhenThrown(True, exSetting)
End If

#3


Here's Bryce Kahle's very useful macro blindly updated to run in VS2010:

这是Bryce Kahle非常有用的宏,盲目更新以在VS2010中运行:

Sub ToggleExceptions()
    Dim dbg As EnvDTE100.Debugger5 = DTE.Debugger
    Dim exSettings As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
    Dim exSetting As ExceptionSetting
    Try
        exSetting = exSettings.Item("Common Language Runtime Exceptions")
    Catch ex As COMException
        If ex.ErrorCode = -2147352565 Then
            exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
        End If
    End Try

    If exSetting.BreakWhenThrown Then
        exSettings.SetBreakWhenThrown(False, exSetting)
    Else
        exSettings.SetBreakWhenThrown(True, exSetting)
    End If

End Sub

#4


First i initalized a timer an then i call the command Exception.Debug. The timer hit, when the modal dialog is openend. If you use Win 7 with deactivated UAC SendKeys with ALT-Key will fail...i don't know why.

首先我将一个计时器初始化,然后我调用命令Exception.Debug。当模态对话框打开时,计时器命中。如果你使用Win 7与停用的UAC SendKeys与ALT-Key将失败...我不知道为什么。

i played a little bit...try this (VS2010 EN):

我玩了一下......试试这个(VS2010 EN):

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Runtime.InteropServices

'...

Private WithEvents t As Timers.Timer
Private Sub t_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles t.Elapsed
    t.Stop()
    ' Tastatureingaben simulieren
    System.Windows.Forms.SendKeys.SendWait("{DOWN}")
    System.Threading.Thread.Sleep(1500) ' Pause wichtig zum Laden des Exceptionbaums
    System.Windows.Forms.SendKeys.SendWait("%t")
    System.Windows.Forms.SendKeys.SendWait("{ENTER}")
End Sub
Public Sub toggleCLRExceptions()
    If DTE.Solution.Count <= 0 Then
        MsgBox("Nicht ohne geöffnete Solution!")
        Exit Sub
    End If
    ' Timer wird benötigt, da der Dialog Modal ist
    ' und weitere Befehle im Macro werden erst nach beenden des Dialogs ausgeführt
    t = New Timers.Timer()
    t.Interval = 0.5
    t.Start()
    DTE.ExecuteCommand("Debug.Exceptions")
    'System.Windows.Forms.SendKeys.SendWait("^%e") ' alternativ: STRG+ALT+e
    System.Threading.Thread.Sleep(200)
    If isCLRExceptionsActive() Then
        MsgBox("BREAK @CLR-Exception", MsgBoxStyle.Information, "Info")
    Else
        MsgBox("NO BREAK @CLR-Exception", MsgBoxStyle.Information, "Info")
    End If
End Sub

Function isCLRExceptionsActive() As Boolean
    ' prüft, ob Setting Debug CLR-Exceptions aktiviert/deaktivert ist
    Dim dbg As EnvDTE100.Debugger5 = DTE.Debugger
    Dim exSettings As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
    Dim exSetting As ExceptionSetting
    Try
        exSetting = exSettings.Item("Common Language Runtime Exceptions")
    Catch ex As COMException
        If ex.ErrorCode = -2147352565 Then
            exSetting = exSettings.NewException("Common Language Runtime Exceptions", 0)
        End If
    End Try
    Return exSetting.BreakWhenThrown
End Function

'...

#5


Well, I wrote a VS2008 C# based plug-in that toggles the 386 exceptions, and it takes about 1 second per state toggle. I'm assuming that's due to COM inter-op.

好吧,我写了一个基于VS2008 C#的插件,可以切换386个异常,每个状态切换大约需要1秒。我假设这是由于COM互操作。

This was based on the VB/macro code in the one of your links. I could not find an easier C++ method (but not ruling it out).

这是基于您的一个链接中的VB /宏代码。我找不到更简单的C ++方法(但不能排除它)。

The next level would be to make a plug-in that has a keyboard binding, that then opens the Exceptions UI and then "clicks" the correct tick box for you.

下一个级别是制作一个具有键盘绑定的插件,然后打开Exceptions UI,然后为您“点击”正确的复选框。

Good luck.

#6


You could use a tool like AutoHotKey to create a recorded script (mouse clicks or key presses) and then assign it a hotkey that will play it back when pressed...

您可以使用AutoHotKey之类的工具创建录制的脚本(鼠标点击或按键),然后为其分配一个热键,按下后将播放该热键...

#7


Just offering some info I found on this (here) as I was scouring the net in my futile attempt to help...

只是提供我在这里(这里)发现的一些信息,因为我在网上搜索我的徒劳尝试...

Someone else posed this same question and it was responded to by Gary Chang from MS Support, here's the quoted response:

其他人提出了同样的问题,来自MS Support的Gary Chang回应了这里引用的回复:

I am afraid the Macro code cannot manipulate the operations on the Exceptions dialog box...

我担心宏代码无法操纵“例外”对话框中的操作...

It's important to note that this posting is from December of 2005 so this response may no longer be accurate; either way, thought I'd throw it out there.

重要的是要注意这个帖子是从2005年12月开始的,所以这个回复可能不再准确;不管怎样,以为我会把它扔出去。

#8


The suggestion of setting the special ExceptionSetting for the group does indeed toggle the state of the top-level checkbox. However, it doesn't seem to toggle the individual Exceptions below it in the tree, and moreover, my process does not stop when such exceptions are thrown as it does if I manually check the top-level checkbox. Do you see different behavior?

为组设置特殊ExceptionSetting的建议确实切换了*复选框的状态。但是,它似乎没有在树中切换它下面的单个异常,而且,当我手动检查*复选框时,抛出此类异常时我的进程不会停止。你看到不同的行为吗?

#9


My macro to ignore current CLR exception in runtime. It works like a button 'disable catching this exception type' when an exception pops at debug-time.

我的宏在运行时忽略当前的CLR异常。当调试时弹出异常时,它就像一个按钮'禁用捕获此异常类型'。

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.ControlChars

' execute Macros.MyMacros.VSDebuggerExceptions.IgnoreCurrentExceptionWhenThrown from VS Command Window

Public Module VSDebuggerExceptions

    Sub BreakWhenThrown(Optional ByVal strException As String = "")
        Dim dbg As Debugger3 = DTE.Debugger
        Dim eg As ExceptionSettings = _
            dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
        eg.SetBreakWhenThrown(True, eg.Item(strException))
    End Sub

    ' copied from Utilities module (samples)
    Function GetOutputWindowPane(ByVal Name As String, Optional ByVal show As Boolean = True) As OutputWindowPane
        Dim window As Window
        Dim outputWindow As OutputWindow
        Dim outputWindowPane As OutputWindowPane

        window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
        If show Then window.Visible = True
        outputWindow = window.Object
        Try
            outputWindowPane = outputWindow.OutputWindowPanes.Item(Name)
        Catch e As System.Exception
            outputWindowPane = outputWindow.OutputWindowPanes.Add(Name)
        End Try
        outputWindowPane.Activate()
        Return outputWindowPane
    End Function

    Private WithEvents t As Timers.Timer

    ' Adds the current exception to ignore list
    Sub IgnoreCurrentExceptionWhenThrown()
        Dim commandWin As EnvDTE.CommandWindow
        commandWin = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow).Object

        Select Case DTE.Debugger.CurrentMode
            Case dbgDebugMode.dbgDesignMode
                commandWin.OutputString("This macro is not enabled in Design Mode. Run it in Break Mode." + vbCrLf)
                Return

            Case dbgDebugMode.dbgRunMode
                commandWin.OutputString("This macro is not enabled in Run Mode. Run it in Break Mode." + vbCrLf)
                Return
        End Select

        commandWin.OutputString(Environment.NewLine)
        commandWin.OutputString("Trying to get the information about current exception.." + Environment.NewLine)

        Dim dbg As Debugger3 = DTE.Debugger
        Dim currentExpression As Expression = dbg.GetExpression("$exception", False)
        Try    
            Dim currentExceptionTypeString As String = currentExpression.DataMembers.Item(1).Type
            commandWin.OutputString("Detected current exception type is : " + currentExceptionTypeString + Environment.NewLine)

            Dim flag As Boolean = True
            Dim eg As ExceptionSettings = dbg.ExceptionGroups.Item("Common Language Runtime Exceptions")
            Try
                eg.SetBreakWhenThrown(False, eg.Item(currentExceptionTypeString))
            Catch exc As Exception
                commandWin.OutputString("Cannot find this exception, trying to create.." + currentExceptionTypeString + Environment.NewLine)
                '
                eg.NewException(currentExceptionTypeString, New Random().Next)
                eg.SetBreakWhenThrown(False, eg.Item(currentExceptionTypeString))
                eg.SetBreakWhenUserUnhandled(True, eg.Item(currentExceptionTypeString))
                flag = False
            End Try

            commandWin.OutputString(Environment.NewLine)
            commandWin.OutputString("Exception '" + currentExceptionTypeString + "' added to ignore list.")
            commandWin.OutputString(Environment.NewLine)

            t = New Timers.Timer()
            ' small interval to send keys after DTE will start to exec command
            t.Interval = 0.1
            t.Start()
            DTE.ExecuteCommand("Debug.Exceptions")

        Catch exc As Exception
            commandWin.OutputString("Error occured")
        End Try
    End Sub

    Private Sub t_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles t.Elapsed
        t.Stop()
        ' only press Ok to apply changed exceptions settings to debugger
        System.Windows.Forms.SendKeys.SendWait("%t")
        System.Windows.Forms.SendKeys.SendWait("{ENTER}")
    End Sub

End Module

#10


CTRL + ALT + E ALT + T Enter

CTRL + ALT + E ALT + T输入

works for me

适合我