How to quickly tell Visual Studio to terminate with each exception

Currently, if I want to say that Visual Studio 2010 has settled on an exception, I have to go to the Debug / Exceptions ... menu (or Ctrl + Alt + E) and click the "Cast" checkbox in the "CLR Exceptions" section. This is a time consuming process, especially if I need to switch them with some regularity.

Is there a faster way to switch this feature? Perhaps using a keyboard shortcut.

+4
source share
1 answer

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 box.

+1
source

All Articles