DebugBreak() equivalent in C#

前端 未结 4 1132
情书的邮戳
情书的邮戳 2020-12-16 10:42

In C# is there any statement equivalent to DebugBreak()? I want to invoke the debugger when ever a particular condition is met.

4条回答
  •  再見小時候
    2020-12-16 11:21

    System.Diagnostics.Debugger.Break();
    
    //Lauches the JIT debug window
    System.Diagnostics.Debugger.Launch();
    

    This is particularly useful when debugging a service as you get the Just In Time debugger window and can then select the visual studio window to debug the service in.

提交回复
热议问题