Debuuger Stop or break?

  • Thread starter Thread starter Eric Kiernan
  • Start date Start date
E

Eric Kiernan

i'd like to stop and break into debugging mode if a certain condition is
true. I have a line counter ( i'm reading a text file ), and I want
it to break at a certain line of the textfile. so i'd like to say
something like if ( lineCntr == 141) {
break;

documentation seems confusing.
 
i'd like to stop and break into debugging mode if a certain condition is
true. I have a line counter ( i'm reading a text file ), and I want it to
break at a certain line of the textfile. so i'd like to say something
like if ( lineCntr == 141) {
break;

documentation seems confusing.

Set a breakpoint. Then right-click the red circle breakpoint symbol and
check out the options on the context menu.

You're going to have to maintain the line count yourself in a variable, of
course. If that's what lineCntr is, then you're golden.
 
Hi Eric,

In addition to using breakpoint conditions you can programmatically break at
any point in your code.

if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
System.Diagnostics.Debugger.Break();

Usually the conditions are simple enough to put on the breakpoint itself,
though.
 
That is very good to know. With both tools for breaking, i feel much
better ( I know the first one works ), and i'll soon test the second.
 
Back
Top