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;
}
}
A partial class is a special feature of C#. It provides a special ability to implement the functionality of a single class into multiple files and all these files are combined into a single class file when the application is compiled. A partial class is created by using a partial keyword.
Partial Class is a unique feature of C#. It can break the functionality of a single class into many files. When the application is compiled, these files are then reassembled into a single class file. The partial keyword is used to build a partial class.
A partial class, or partial type, is a class that can be split into two or more source code files and/or two or more locations within the same source file. Each partial class is known as a class part or just a part. Logically, partial classes do not make any difference to the compiler.
A partial class is one that can be split among multiple physical files. This feature came in C# 2.0. The partial class break the definition of class two or more than two class files, but it will be together at compile time as one class. Now here we will be using partial concept in MVC using entity framework.
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
attributeIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With