Condividi tramite


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

Comments

  • Anonymous
    August 11, 2008
    Surely the non user code is that code automatically created by the VS IDE at design time, esp whilst creating wpf forms.  This is machine generated code and not user generated code. I could be wrong so please don't quote me outright.

  • Anonymous
    August 12, 2008
    My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Yesterday, Visual Studio 2008 SP1 and .Net 3.5 SP1 were released. Below is a list of links related to those releases: Greg Duncan

  • Anonymous
    August 13, 2008
    in yesterday’s tip , i explained what is and isn’t your code. One of the ways to make your code not yours

  • Anonymous
    February 18, 2009
    W opcja Visual Studio możemy znaleźć ciekawą opcję (Tools –> Options –> Debugging –>