Visual Studio 2015 debugger stops for the DebuggerHidden function exception handled

I want the debugger to stop when:

  • A processed or unhandled exception is thrown.
  • An unhandled exception occurs in a function that has the DebuggerStepThrough or DebuggerHidden attribute. The debugger should stop where this function is called.

While there is no problem, I could get Visual Studio 2015 to work like this. However, when an exception is thrown in a function with DebuggerStepThrough or DebuggerHidden , the debugger stops where this function is called.

I could not find a way to fix this. I do not remember this behavior in Visual Studio 2010 or 2013. I searched about it and did not find anyone who asked about the same problem.

Edit: I tried DebuggerNonUserCode , the result is the same. It says: "Exception thrown." No! enter image description here

My settings: enter image description here

0
c # visual-studio-2015 visual-studio-debugging
Jan 31 '17 at 18:24
source share
2 answers

You can use the DebuggerNonUserCode attribute instead of the DebuggerStepThrough or DebuggerHidden attribute in VS2015, as there are a few small differences between them:

https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/12/using-the-debuggernonusercode-attribute-in-visual-studio-2015/

Update:

I get the same problem as yours using VS2015. I found that this will be related to the debugging option, please enable the option "Use managed compatibility mode" in the TOOLS-> Options-> Debugging section. Debug it again.

enter image description here

+1
Feb 01 '17 at 5:29 on
source share

MSDN article Using the DebuggerNonUserCode attribute in Visual Studio 2015 explains what DebuggerNonUserCode does and why it doesn't ignore exceptions.

This is due to performance improvements in VS 2015

when only my code is enabled, the debugger no longer receives notifications about exceptions that are thrown and handled outside of "your code".

This leads to a big performance improvement because:

Debugging performance has improved because when Just My Code is enabled, the debugger no longer receives exception notifications that are thrown and handled outside of "your code".

This behavior can be disabled using the registry key updated with Update 2:

To enable this, run the following command at a command prompt that will configure the registry for you:

reg add HKCU\Software\Microsoft\VisualStudio\14.0_Config\Debugger\Engine /v AlwaysEnableExceptionCallbacksOutsideMyCode /t REG_DWORD /d 1 

You will need to experiment and see what is more important, ignoring exceptions or better debugger performance.

+1
Feb 01 '17 at 8:38 on
source share



All Articles