Search code examples
debugging

What's your favorite dummy line to put a break point on?


Few of us would deny the awesomeness of debuggers, but to make it more useful, some tricks can be used.

For example in Python, you can use pass to do absolutely nothing except to leave you room to put a break point and allow you to observe the values in the Watch window.

In C#, I used to do GC.Collect(), but now I use if (false){}

What's your most playful dummy line?


Solution

  • In C#, you can use this:

    System.Diagnostics.Debugger.Break();
    

    It will force a breakpoint.