添加一个
DebuggerStepperBoundaryAttribute
到单步执行时要跳过的方法。
在示例代码中,当执行在
Method1()
调用并逐步执行代码,而不是结束在内部
Method2
,代码执行将继续
Console.WriteLine("Suddenly here")
(当然,这两个代码
Method1
和
方法2
运行:
static void main(string[] args)
{
Method1();
Console.WriteLine("Suddenly here");
}
[DebuggerStepThrough, DebuggerStepperBoundary]
private static void Method1()
{
Method2();
}
private static void Method2()
{
//Skipped
Console.WriteLine("Skipped but still printing");
}