I wrote app that uses while loop. And in my code I forgot to put break
in a specific condition. I am running the application from the debugger. Now I need to quit from the loop. Some people could say just stop it and put that break line in, but I can't at this point. Changing the code and running again takes long time. Is there way to stop this from the watch window or Immediate Window?
Here is example of loop that I have:
while(true)
{
//do the work
if(something happens)
break; //I missed this part!
}
//some other things
Thanks for the help!
You should re-write your
while
loop to use a variable instead oftrue
, then you can use the debugger to change the value of your variable tofalse
and end the loop, like this:Now in the debugger, you can break on your loop and update the
doWork
variable tofalse
if you want to break out of the loop.