In Visual Studio 2015, DebuggerStepThrough no longer skips exceptions?

In earlier versions of Visual Studio, you can use the [DebuggerStepThrough] attribute to ignore an exception in a special method that cannot be avoided for some reason (network exceptions, for example, or maybe unsuccessful parsing). (See This topic: Do not stop the debugger with this THAT exception when it is thrown and caught )

Now, Visual Studio shows me an exception in the calling function without an attribute, even if it is already caught and processed.

Example:

static void Main(string[] args) { ExceptionalMethod(); } [DebuggerStepThrough] static void ExceptionalMethod() { try { throw new Exception("BAM"); } catch { } } 

This code should not stop in VS 2013 or below. Same behavior with DebuggerHidden.

Is there a new trick to ignore this one exception? Without ignoring all the exceptions to this type of course?

+4
source share
1 answer

Microsoft has deactivated this feature due to "a useful performance improvement when debugging .NET code."

In Visual Studio 2015 Update 2, you can enable / disable performance by changing the registry key.

Enter this in your command line to do this:

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

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

+4
source

All Articles