I came across a neat little trick relating to diagnostics this morning. The System.Diagnostics.DebuggerStepThroughAttribute attribute will add metadata to a method such that when the debugger sees the attribute it will not step into the method even when the developer chooses the "StepInto" command. You can still place breakpoints, however. If you happen to now want breakpoints to work in the method either, you can use the System.Diagnostics.DebuggerHiddenAttribute attribute.
While I was checking out the above attributes I came across one more called System.Diagnostics.DebuggableAttribute. The name of this one sounds a lot cooler than it actually is, however. Based on my understanding (which I suspect may be missing something) this is cool sounding attribute affects what code the JIT compiler generates only. It is not clear what functionality it adds and when one would choose to use it.
Before we leave the System.Diagnostics there is one more class to check out, System.Diagnostics.Debugger. This class has a Break() method on it which causes the debugger to break on the line following this function.
I have posted the sample code that I used to check out this stuff here. I confess that the project and solution files may not be compatible with Visual Studio.NET 2002 so you may need to create a new project and add the cs files manually.
[http://mark.michaelis.net/Blog/SystemDiagnosticsDebuggerStepThrough AndMoreSystemDiagnosticsNamespaceStuff.aspx]