Break on Exception Throw — Setting the Default

2019-07-29 11:48发布

How do you change the defaults for Visual Studio, to tell it to break on access violations by default (for example)? I've tried Debug->Exceptions but it only works on a per-solution (or per-project?) basis, not globally.

Thank you!

1条回答
Lonely孤独者°
2楼-- · 2019-07-29 12:16

The default is for all the exceptions to be turned off and settings are saved per solution as you described.

http://msdn.microsoft.com/en-us/library/d14azbfh.aspx

You could write a macro to turn on a default set of exceptions for you by calling SetBreakWhenThrown() on specific exception settings.

http://msdn.microsoft.com/en-us/library/envdte90.exceptionsettings.setbreakwhenthrown.aspx

macro example:

Dim eg As ExceptionSettings = CType(DTE.Debugger, Debugger3).ExceptionGroups.Item("Common Language Runtime Exceptions")
eg.SetBreakWhenThrown(True, eg.Item("System.AccessViolationException"))
查看更多
登录 后发表回答