Sam*_*ron 12 c# debugging visual-studio
该DebuggerStepThrough属性你可以跳过闯入某些方法/类/属性.
在DebuggerStepThrough被忽略时,澄清了c#编译器没有将此属性继承到编译器生成的IEnumerable<T>实现中.
这种失败的一个小例子是:
static void Main(string[] args)
{
var a = SkipMe().ToList();
}
[System.Diagnostics.DebuggerStepThrough]
static IEnumerable<int> SkipMe()
{
// comment out line below and the throw will be stepped over.
yield return 1;
throw new Exception();
}
Run Code Online (Sandbox Code Playgroud)
有没有办法让C#编译器将DebuggerStepThrough属性添加到自动生成的类型?
有没有办法让visual studio跳过调试到[CompilerGenerated]属性的任何类型?
-
附录:一些说明性的截图
按下后的结果 F5

Visual Studio版本:

我们缺少的属性:

我认为没有办法达到您正在寻找的效果。
DebuggerStepThrough到包含迭代器方法的类来解决此问题。调试器仅查看直接父类型,而不查看包含嵌套类型的类型。我能想到实现这一点的唯一真正方法是将所有不想调试的代码放入单独的 DLL 中。然后不要加载该特定 DLL 的 PDB。
| 归档时间: |
|
| 查看次数: |
1687 次 |
| 最近记录: |