How to make [DebuggerNonUserCode] hide an exception from the debugger in simple test case?

Mystery solved. It is indeed a known issue that is new to MSVS 2015 because of added exception handling optimizations.

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

There is a workaround posted on that link to disable the optimizations and enable the old behavior. Hopefully they will eventually be able to revive the support for this including the optimizations.

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

Related question:

Don’t stop debugger at THAT exception when it’s thrown and caught

Leave a Comment