Tuesday, June 14, 2011

Beware the conditional breakpoint that alters execution

A conditional breakpoint caused a good head scratcher today.

The before picture looks reasonable. The conditional breakpoint will stop execution when the parameterName variable equals some value.

The after picture however shows the simple but disastrous mistake.

The conditional breakpoint is capable of assignment (which evaluates to false). So it will happily and transparently (unless you are looking closely) change the parameterName during execution.