How to set conditional breakpoints in Visual Studio?

前端 未结 13 2334
忘了有多久
忘了有多久 2020-11-27 03:35

Is there an easy way to set conditional breakpoints in Visual Studio?

If I want to hit a breakpoint only when the value of a variable becomes something, how can I do

13条回答
  •  情深已故
    2020-11-27 04:21

    When you are using Express edition you can try this:

    #if DEBUG
        if( fooVariable == true )
            System.Diagnostics.Debugger.Break();
    #endif
    

    if statement makes sure that in release build breakepoint will not be present.

提交回复
热议问题