views:

95

answers:

2

Is it any best practice to tag .net generated code?

What I want to achieve is following:

  • Debugger step by default not inside the property or method
  • Metrics are not calulated for those classes/members
+2  A: 

Well, for the first - attributes ([DebuggerStepThrough] being the most important for your question); some useful ones here:

[DebuggerStepThrough, DebuggerHidden, DebuggerNonUserCode]
[CompilerGenerated] // arguably untrue...

Not sure about the second question.

Marc Gravell
I'm with mark on this - If you don't like the how the code metrics are being evaluated on your generated code maybe you need to adjust your templates?
James Fleming
A: 

You might consider using Postsharp to manipulate the code once it is compiled.

Miha Markic