Similar to @Relster I have a code snippet with the following
#if DEBUG if( node.Name == "Book" ) System.Diagnostics.Debugger.Break(); #endif
Where node.Name == "Book" changes depending on the condition for which I want to check. the #if DEBUG wrapper ensures that checks never force it to free code.
It is also much faster than using conditional breakpoints in Visual Studio. When you use the built-in conditional bp, the visual studio must enter the application, pause all threads, evaluate the expression and determine if it is true every time it hits the breakpoint. In a narrow loop, this may be the difference between near-full performance and launch bypass.
Paul alexander
source share