Tuesday, 10 September 2013

I sometimes add code to insert a breakpoint. Is there another way? If not, what's the best solution?

I sometimes add code to insert a breakpoint. Is there another way? If not,
what's the best solution?

This is a silly thing I catch myself doing once in a while and I feel that
it is a bad habit. It usually goes like this:
I try to place a breakpoint but cannot because there is not a valid
stopping point for the processor.
So I insert a silly code to break on and then delete later. (unless it
gets forgotten D:)
For example, let's say I want to pause inside an empty constructor like
this one:
public ImAConstructor()
{
//I want to break here but can't :(
}
So I do something like this instead:
public ImAConstructor()
{
int testVar = 0; //TODO: Delete this code. Temporarily inserted to
break on.
}
Which just feels ugly to type and probably upsets the programming gods.
I would like a way to do this that doesn't risk leaving pointless code
that could confuse others.

No comments:

Post a Comment