Sdílet prostřednictvím


Visual Studio Tips and Tricks – Easier debugging with “Just My Code”

VisualStudioLogoThe Just My Code feature in Visual Studio 2013 makes it easier for you to debug your code in Visual Studio.

Find more Visual Studio tips and tricks here

Why do I want this feature?

Does this story sound familiar? You set a breakpoint in your code. You get to the breakpoint and you hit Step Into (or the <F11> key) to walk through your code and then suddenly you reach a line of code like this one:

 

  picker.pickSingleFileAsync().done(function (file) {

Next thing you know, you’ve stepped into the code for the FilePicker asynchronous method call. What you probably wanted to do was step to the next line of your code to check the format of the URL returned so you could make sure you were setting the source property correctly for your image control. Now that you’ve stepped into the system call, you have to either step through all that system code or hit Step Out, and be careful not to hit Step Out too often or you exit the debugger and return to your application and have to start all over.

This is where the Visual Studio 2013 feature “Just My Code” fits in. When enabled it basically tells the debugger, not to step into system calls. So as you step through your code it really is stepping through *your* code.

How to Enable/Disable Just My Code

  1. From the menu select Tools | Options
  2. Go to the Debugging node, choose General
  3. Select or clear Enable Just My Code.

image

This feature is enabled by default in Visual Studio 2013 and is available in all the editions of Visual Studio 2013 (including the Express editions.)

If you are using programmatic break statements such as Visual Basic Stop statements, the debugger will always break on these statements, even if Just My Code is enabled.

You can find the MSDN Documentation of this feature here.

Where do I get Visual Studio 2013?

Students can download Visual Studio 2013 Professional at DreamSpark

MSDN subscribers can download it from MSDN

Anyone can get express versions of Visual Studio for free or 90 day trials of Visual Studio Professional, Premium, or Ultimate at the Visual Studio downloads center.

Comments

  • Anonymous
    December 05, 2013
    If you are unable to upgrade: This feature is also available in VS2012.

  • Anonymous
    December 05, 2013
    The feature was available to .NET developers in VS2012, but I believe the support for JavaScript was added in 2013.