When More is less

Sometimes more is less. You may do more work to add a feature that turns out to get in the customers way.

Here are some examples we've hit in the debugger-space:

Example 1: Funceval: When you do a func-eval (via ICorDebugEval::Call*Function), the CLR erects a try-catch to backstop any exceptions that get thrown out of the target function. So if you func-eval a property that throws (eg, perhaps you call a getter at an unexpected time and get a null-ref exception), the func-eval catches the exception so that it doesn't leak it out to the rest of your program. The debugger than can tell you that the eval failed with an exception.

However, sometimes people want the exception to leak out! A specific example is "fault-injection" in the context of RAD-debugging. You may be at some point in your program and want to test an exception error path. The user might want to be able to inject an exception at the current statement.  Our doing extra work to erect a try-catch around a func-eval gets in the way here.

Example 2: Stepping: In VS, let's say you step, and then hit a breakpoint in the middle of your step. That original step is lost. For example, you may F10 on thread A, and then hit a breakpoint on Thread B. The step operation on thread A is killed, and so when you resume from Thread B, the whole process keeps running.

That can be very annoying when debugging multiple-threads. ICorDebug (underlying debugger API) lets you have as many steppers as you want. However, VS is doing extra work to manage the steppers and maintain an "active" stepper. So VS does extra work to kill off the stepper on Thread A.

Example 3: Error checks: Imagine if you've got a very useful feature that, but it only works 90% of the time and crashes the other 10% of the time. You could go do extra work to add error checks, but let's say you can't exactly discern the 10% zone and so you err on the side of safety and eliminate 15% (I blogged about possible reasons this could happen here). In this case, you've done extra work to add safety checks that prevent 5% of cases that were valid.