BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Debugging
VS 2005+

Debugging Just My Code

Visual Studio includes an option that prevents the debugger from stepping through certain code. This simplifies the debugging process by allowing the programmer to concentrate on their own code, rather than that which was generated automatically.

User Code

User code is the source code that you manually create within your projects. There are several types of code that Visual Studio considers to be non-user code. This includes automatically generated code, such as the code that initialises an application or places controls within windows. It also includes code that you have developed yourself but have marked as non-user code with the DebuggerNonUserCode attribute.

Just My Code

When debugging an application, it is unlikely that you will want to step into non-user code because you usually have little or no control over it. It is simpler to only step into user code and only show user code elements in debugging windows, such as when viewing the call stack. By default, Visual Studio performs this filtering using a feature named, "Just My Code".

When Just My Code is enabled, other debugging behaviours are modified in order to hide non-user code. If there is a breakpoint in the non-user code, it is ignored. If an exception is thrown from hidden code, the exception stops the debugger in the user code, at the point that called the failing member. The stack trace does include details of the non-user code, helping you to track down the problem.

You can enable or disable the Just My Code feature from the Options dialog box. Select "Options" from the "Tools" menu to show the dialog box. Expand the "Debugging" section at the left of the window and select the "General" element. You can then use the checkbox alongside the "Enable Just My Code" setting, pictured below.

Visual Studio Just My Code Option

7 November 2015