Friday, October 06, 2006

[.NET] Debugger, dont STEP INTO my method !

Had you experienced whenever you debug your application using the step-into feature (F11), the debugger will go through the implementation of the methods being called, which you might not want it to. How do you "tell" the debugger to skip the method and move on to next statement? Here is the answer.

using System.Diagnosis;

[DebuggerStepThrough]
public void MyMethod()
{
....
}


Be noted, the [DebuggerStepThrough] attribute can be used in the get/set of property, too.


public string MyProperty
{
[DebuggerStepThrough]
get { }
}



MyMethod : "Thanks for skipping over me, Debugger !"

No comments: