我在WinForms(.net 3.5)中工作,并具有以下代码行:
- HitTestResult result;
- try
- {
- result = this.HitTest( e.X,e.Y,ChartElementType.DataPoint);
- }
- catch(Exception e)
- {
- //This happens,we don't care!
- }
我无法控制HitTest是否抛出异常,但如果是这样,我绝对不在乎.
是否可以禁用我的IDE停止在这个SPECIFIC catch块?我明白我可以禁用它可能抛出的System.FormatException(从Debug->例外菜单,但这是一种过度的杀戮.
谢谢!
解决方法
您可以使用
DebbugerStepThrough属性跳过该行.从MSDN:
Instructs the debugger to step through the code instead of stepping
into the code.
例如:
- [DebuggerStepThrough]
- public void MyMethod()
- {
- HitTestResult result;
- try
- {
- result = this.HitTest(e.X,ChartElementType.DataPoint);
- }
- catch (Exception e)
- {
- //This happens,we don't care!
- }
- }