部分类调试
我已经为我的 xsd 自动生成的类创建了一个部分类。问题在于调试这个部分类。无法识别断点或者编译器不会在分部类中设置的断点处中断。
// Autogenerated class by xsd.exe
public partial class Class1
{
private Class1Brand[] brandField;
private string Class1guidField;
.....
}
// Debug Part - probably in a different file
public partial class Class1
{
public static Validity setValidity(Validity validity)
{
// ********* BREAKPOINT IS SET ON THE NEXT LINE ***********
validity.LastVerified = DateTime.Now;
//certificates are only updated within 14 days before expiry date
TimeSpan tsCheck = validity.NotAfter - validity.LastVerified;
if (tsCheck.Days <= 14)
{
DateTime dtNotBefore = validity.NotAfter.AddDays(conf.validityPeriod());
if (validity.NotAfter > DateTime.Now)
{
dtNotBefore = validity.NotAfter;
}
else
{
dtNotBefore = DateTime.Now;
}
validity.NotBefore = dtNotBefore;
validity.NotAfter = dtNotBefore.AddDays(conf.validityPeriod());
}
return validity;
}
}
I have created a partial class for my xsd auto generated class. The problem is in debugging this partial class. Breakpoint are not recognized or the compiler doesn't break at the breakpoints set in the partial class.
// Autogenerated class by xsd.exe
public partial class Class1
{
private Class1Brand[] brandField;
private string Class1guidField;
.....
}
// Debug Part - probably in a different file
public partial class Class1
{
public static Validity setValidity(Validity validity)
{
// ********* BREAKPOINT IS SET ON THE NEXT LINE ***********
validity.LastVerified = DateTime.Now;
//certificates are only updated within 14 days before expiry date
TimeSpan tsCheck = validity.NotAfter - validity.LastVerified;
if (tsCheck.Days <= 14)
{
DateTime dtNotBefore = validity.NotAfter.AddDays(conf.validityPeriod());
if (validity.NotAfter > DateTime.Now)
{
dtNotBefore = validity.NotAfter;
}
else
{
dtNotBefore = DateTime.Now;
}
validity.NotBefore = dtNotBefore;
validity.NotAfter = dtNotBefore.AddDays(conf.validityPeriod());
}
return validity;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XSD 使用
DebuggerStepThroughAttribute
< 装饰所有生成的类/a>,这可以防止调试器在标有此属性的方法/类中停止。要解决此问题:
XSD decorates all generated classes with
DebuggerStepThroughAttribute
, which prevents the debugger from stopping in a method/class marked with this attribute.To solve this:
DebuggerStepThrough
attribute