Debugging a for loop; Flash forward

So, I am working on a project in which I really have a lot of cycles, and I usually encounter problems when approaching the end of the cycle, but it is almost impossible to get it manually, entering the cycle of millions of time. I know that I can just change the counter variable, but in this case this will not work, because the side effects of each iteration will not happen. Is there a way to make a breakpoint stop in place after 999999998 iterations? I am using Visual Studio Ultimate 2010

+6
source share
3 answers

put a breakpoint, right-click on it, select a condition set

i == 999999998 //if your loop looks like for (var i == 0;.... 
+10
source

As Raphael says, you can set a condition on a breakpoint. However, if this occurs in a closed loop, overhead conditions can be quite significant. I found that doing code checking and calling Debugger.Break works much better in this case.

+3
source

I just insert an image to render Raphaël Althaus Answer enter image description here

+1
source

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


All Articles