VS2015 throws an exception in DebuggerStepTrough?

I just updated my VS2013, and the same code has different behavior in debug mode.

In VS2013, I had a debug exception violation that I received.

Some of them that can happen and are processed have been placed in a Try-catch block using DebuggerStepTrough:

Example:

[DebuggerStepThrough]
private void DoSomething(){
    try{
        throw new InvalidOperationException();//Obviously in my case, it not a throw exception here but a method
    }catch(InvalidOperationException){
        //log something & handling this case
    }
}


private void SomeEntryPoint(){
    DoSomething();//In VS2015 I got the debug breaking here. In VS2013 I don't
}

I did not have this behavior in VS2013. Is there any way to avoid this?

(I have "Only my code" enabled)

+4
source share
1 answer

, Visual Studio 2015. clr, - ( ).

, , [DebuggerHidden], [DebuggerNonUserCode] / [DebuggerStepThrough], , - - Visual Studio 2015 ( - , Visual Studio 2013).

, . 2 :

  • .net framework < 4.0
  • , / , / .

, Visual Studio Visual Studio 2015.

Visual Studio 2015 Update 2 DebuggerNonUserCode Visual Studio 2015 blog .

, , . :

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

Source: https://habr.com/ru/post/1618539/


All Articles