We’re quickly approaching the last of the Debugger attributes in the System.Diagnostics namespace. After this week there are only two more to go, but don’t despair, because I’ve saved the best till last. However for now let’s take a look at the DebuggerNonUserCode and DebuggerStepperBoundary attributes.
The DebuggerNonUserCode attribute has the same effect as using both the DebuggerHidden and DebuggerStepThrough attributes at the same time. In the default Visual Studio configuration, code marked with this attribute will appear as external code in the call stack as shown below. As with the DebuggerStepThrough attribute, breakpoints cannot be set in blocks of code marked with this attribute. Stepping through code will step into any code called by that block of code in the same way it does for the DebuggerHidden attribute.

Code that is marked with the DebuggerNonUserCode attribute will be visible in the call stack if you disable the Just My Code option under Tools->Options->Debugger->Enable Just My Code (Managed Only).
DebuggerStepperBoundary is probably the most obscure of all of the Debugger attributes, as it only comes into effect under quite specific conditions. It is used to avoid a misleading debugging experience that can occur when a context switch is made on a thread within the boundaries of the DebuggerNonUserCode attribute. It is entirely possible in this scenario that the next user-supplied code module stepped into may not actually relate to the code that was in the process of being debugged. To avoid this undesirable situation, the DebuggerStepperBoundary, when encountered under this scenario, will escape from stepping through code to running code.
As with all of the debugger attributes, both the DebuggerNonUserCode and DebuggerStepperBoundary attributes are ignored by the CLR and as such have no affect during normal execution. So you do not need to worry about any implications of leaving any of these attributes in place in production code.














