M.kazem Akhgary
M.kazem Akhgary

Reputation: 19149

disable DebuggerStepThrough for partial class

I have set of classes that are auto generated by tool. but all classes are marked with DebuggerStepThrough attribute

the classes are partial, so I can write my code for that class in separate file, however DebuggerStepThrough in auto generated part of partial class will affect entire class.

How can I disable this behavior for DebuggerStepThrough, removing DebuggerStepThrough is obvious solution but that's not the answer I'm looking for. I don't want to touch auto generated code. also skipping from auto generated code is ok, but I want to be able to debug my own code.

[DebuggerStepThrough]
partial class Foo
{
   // auto generated
}

// how to exclude this part from DebuggerStepThrough?
partial class Foo
{
   // user code
}

Upvotes: 0

Views: 632

Answers (1)

maccettura
maccettura

Reputation: 10818

What you are asking to do is impossible as far as I know. Partial class attributes are merged at compile time. So your two partial classes:

[DebuggerStepThrough]
partial class Foo
{
    // auto generated
}

partial class Foo
{
    // user code
}

Compile to this:

[DebuggerStepThrough]
class Foo
{
    // auto generated

    // user code
}

Upvotes: 1

Related Questions