Did you know… what is just your code? - #289

Under Tools – Options – Debugging – General, you’ll see the option “Enable Just My Code”

Enable Just My Code

Of course, your code is your code, unless it isn’t your code. Who knows? What I do know is what happens when you check or uncheck this checkbox.  But first, let’s talk about what’s “just your code”

In the words of the MSDN documentation, Just My Code hides non-user code so that it does not appear in the debugger windows. When you step, the debugger steps through any non-user code but does not stop in it.

Okay, that’s cool, but what’s non-user code?  These are the conditions that I know about that cause your code not to be just your code (aka non-user code):

Let’s walk through an example…

Suppose I have two projects in a solution: ClassLibrary1 and ConsoleApplication1.  The console app calls the class library to get a simple “hello world” string to display to the console.  Let’s say that I mark the ClassLibrary1 to be optimized when built. Now when I put a breakpoint on the Console.WriteLine wrapper method and try to step in, i’m denied (well, it does the functional equivalent of just hitting F10 instead of F11).

Just My Code causes F11 to act like F10 for non-user code

Technorati Tags: VS2005Tip,VS2008Tip