Toggle “Break when an exception is thrown.” using macro or keyboard shortcut

前端 未结 10 1529
情深已故
情深已故 2020-11-29 23:51

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 i

10条回答
  •  盖世英雄少女心
    2020-11-30 00:13

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

    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
    

提交回复
热议问题