阻止DebuggerStepThroughAttribute应用于我的非xsd生成的部分类? [英] Prevent DebuggerStepThroughAttribute from applying to my non-xsd-generated partial class?
问题描述
我使用xsd.exe工具根据我的xml模式生成一个类。它使用DebuggerStepThroughAttribute创建了一个公共部分类。那么,我创建了这个类的另一个部分类文件来编写我的自定义代码,并希望能够进入我编写的代码,但似乎调试器正在将step-through属性应用到我的<强>部分类也。有没有一个简单的方法来进入我的代码,而不需要在每次重新生成部分类时手动删除属性?
I used the xsd.exe tool to generate a class based on my xml schema. It created a public partial class with DebuggerStepThroughAttribute. Well, I created another partial class file for this class to write my custom code and want to be able to step-into this code I've written but it appears the debugger is applying the step-through attribute to my partial class as well. Is there an easy way for me to step-into my code without manually removing the attribute each time I re-generate the partial class?
推荐答案
- 您可以使调试器在工具 - >选项 - >调试器 - >常规下忽略此属性。取消选中启用我的代码(仅管理)。
- 您也可以使用部分类作为另一个类/方法的包装器。部分类中的方法只是在新类中调用实际方法的存根。调试器将跳过使用该属性装饰的方法,但仍允许您遍历它们包装的类。下面的例子...
//
[DebuggerStepThrough]
static void DebuggerStepThroughInPartialClass()
{
WrappedClass.NonDebuggerStepThrough();
}
class WrappedClass{
static void NonDebuggerStepThroughInNewClass()
{
int bar = 0;
bar++;
}
}
这篇关于阻止DebuggerStepThroughAttribute应用于我的非xsd生成的部分类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!