2011-10-27 49 views
4

當前,如果我想告訴Visual Studio 2010停止異常,我必須去調試/例外...菜單(或Ctrl + Alt + E)並點擊CLR Exceptions下的Thrown複選框。這是一個耗時的過程,特別是如果我需要按照某種規律切換這些過程。如何快速告訴Visual Studio停止每個異常

是否有更快的方式來切換此功能?也許用鍵盤快捷鍵。

+0

可能的重複:http://stackoverflow.com/questions/958011/toggle-break-when-an-exception-is-thrown-using-macro-or-keyboard-shortcut –

+0

@Valamas我看到了這個問題,它是類似的,但答案涉及到創建宏,其實例非常耗時。我會交易另一個放緩。 – AngryHacker

回答

1

使用這樣的事情:

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 

它會成功檢查頂級複選框在例外對話框。

相關問題