我有一个经常调用的方法,有时会发生我捕获和处理的异常。
但是令人讨厌的是,每次发生异常时VS都会不断破坏该代码,我想告诉VS继续运行,因为无论如何都会处理异常。
所以我尝试使用DebuggerStepThrough属性,但是当我将其插入代码中时,会出现数百个错误。
有没有一种方法可以告诉VS在发生异常时不要在这段特殊的代码上中断
在下面的代码中,我不会在发生异常时调试器中断
// some code here
//[DebuggerStepThroughAttribute()]
[DebuggerStepThrough] // this does not compile
try
{
_Table.PrimaryKey = new DataColumn[] { Table.Columns[PrimaryKeyName] };
}
catch
{ // code for when exception happend...
}
// more code here...