Sunday, April 17, 2011

How can I tag code as generated

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
From stackoverflow
  • 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.

    James Fleming : 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?
  • You might consider using Postsharp to manipulate the code once it is compiled.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.