Reputation: 61646
Currently if I want to tell Visual Studio 2010 to stop on an exception, I have to go to the Debug/Exceptions... menu (or Ctrl+Alt+E) and click on the Thrown checkbox under CLR Exceptions. This is a time-consuming process, particularly if I need to toggle these at some regularity.
Is there a faster way to toggle this feature? Perhaps with a keyboard shortcut key.
Upvotes: 4
Views: 204
Reputation: 691
Use something like this:
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
It will successfully check the top-level check-box in the Exceptions dialog.
Upvotes: 1