Click here to Skip to main content
13,148,103 members (77,396 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 11 Sep 2010

Tips on Debugging : Using DebuggerHidden attribute

, 11 Sep 2010
Rate this:
Please Sign up or sign in to vote.
How to use the DebuggerHidden attribute

DubuggerHidden attribute tells the Visual Studio debugger that the method is hidden from the debugging process and while debugging. This is quite helpful when you don't want to go to stepping inside of a method while debugging.

When you mark a method with DebuggerHidden() attributes, it explicitly tells the debugger not to step inside of that method and no break point will be hit over that method. Now I am going to explain the same using an example with Intellitrace debugging.


Let’s consider you have the below code snippet:

We have set two break points in each of the methods (Line 22, and Line 31 as shown). Now if you run this application and check the output intellitrace debugging window, you will get the below output:


As per the above image, you can see the flow of the application from Main() > Method1() > Method2(). If you also check the current live event’s “Call Stack”, that also represents the call of method2() from method1(). This is as per our expected behavior.

Now, if you don’t need to go inside Method1() while debugging and debugger should not stop inside method1() for any of the breakpoints, you have to add “DebuggerHidden()” attributes with the method1(). If you try to debug the application with the same breakpoint, CallStack() and IntelliTrace debugger view will be something different.


If you check the above image, the debugger reached Method2() through Method1(), but breakpoint in method1() never hits, because of the “DebuggerHidden” attribute.

If you move from “EventView” mode to “CallView” mode in Intellitrace window, you can find the actual flow of sequence of the program.



In this blog post, I have explained how we can hide a method from debugger to step in using “DebuggerHidden” attribute.

Hope this will help you.

My Other Articles on Debugging

Filed under: General, Tips and Tricks, Visual Studio 2010


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Abhijit Jana
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband

Blog :
Web Site :
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
Arnaud Dovi31-May-12 5:52
memberArnaud Dovi31-May-12 5:52 
GeneralMy vote of 4 Pin
Onskee110-Mar-11 8:40
memberOnskee110-Mar-11 8:40 
GeneralRe: My vote of 4 Pin
Abhijit Jana10-Mar-11 11:06
mvpAbhijit Jana10-Mar-11 11:06 
GeneralGreat One Pin
Brij12-Sep-10 5:02
mentorBrij12-Sep-10 5:02 
GeneralRe: Great One Pin
Abhijit Jana12-Sep-10 5:17
mvpAbhijit Jana12-Sep-10 5:17 
GeneralCongrats!!! for the Half Century Pin
KunalChowdhury12-Sep-10 0:05
mentorKunalChowdhury12-Sep-10 0:05 
GeneralRe: Congrats!!! for the Half Century Pin
Abhijit Jana12-Sep-10 2:41
mvpAbhijit Jana12-Sep-10 2:41 
GeneralAwesome - Have 5 Pin
KunalChowdhury12-Sep-10 0:02
mentorKunalChowdhury12-Sep-10 0:02 
GeneralRe: Awesome - Have 5 Pin
Abhijit Jana12-Sep-10 2:42
mvpAbhijit Jana12-Sep-10 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170924.1 | Last Updated 12 Sep 2010
Article Copyright 2010 by Abhijit Jana
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid