Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent DebuggerStepThroughAttribute from applying to my non-xsd-generated partial class?

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?

like image 696
Lyndal Avatar asked Jul 08 '09 18:07

Lyndal


1 Answers

  1. You can make the debugger ignore this attribute under Tools->Options->Debugger->General. Uncheck "Enable Just My Code (Managed Only)".
  2. You could also just use the partial class as a wrapper for another class/methods. The methods in the partial class would just be stubs that call the actual methods in the new class. The debugger will skip the method decorated with the attribute but still allow you to step through the class they wrap. Example below...

//

[DebuggerStepThrough]
static void DebuggerStepThroughInPartialClass()
{
   WrappedClass.NonDebuggerStepThrough();
}

class WrappedClass{
   static void NonDebuggerStepThroughInNewClass()
   {
      int bar = 0;
      bar++;
   }
}
like image 181
William Edmondson Avatar answered Sep 24 '22 02:09

William Edmondson