Hide Methods From Debugger in .Net

DebuggerHidden is one of the productive features in .Net that can improve your productivity. Developers need to do a lot of debugging and when there is a need that we don't want to step inside a method then we can use this feature. The DebuggerHidden attribute tells the Visual Studio debugger that the method is hidden from the debugging process when debugging. This is quite helpful when you don't want to step inside of a method when debugging.
 
When you mark a method with the DebuggerHidden() attribute, it explicitly tells the debugger to not step into the method and no breakpoint will be hit for the method. It's very helpful that when we know a specific method is correct in all conditions or is not doing much that is relevant then we can mark the method with the DebuggerHidden attribute.
 
One more interesting thing is that if the method is calling another method and you want to debug that method then you can put a breakpoint in that method and the debugger will identify and debug another method.
 
So in the following code, you can see that both the breakpoint is hit by the debugger and in intelligence also you can see that. This is the normal way.
 
 
But in the following code, we have the two methods MethodA and Method B. MethodA is marked with the DebuggerHidden attribute and now we place a breakpoint in both methods but you can see the MethodA is not hit by the debugger but the MethodB is hit by the debugger. In Intellitrace you can also observe that.
 
 
I hope this will help you and you will use it.