Wednesday, April 06, 2005 - Posts

Why testing apps in the IDE is a bad idea

There's recently been some discussion (here and here) on how JIT optimizations can quite dramatically change the behavior of the garbage collector, and thus the behavior of your application. Stephen Toub pointed out that this change in GC behavior occurs because the debugger is attached, regardless of whether you are in debug or release mode. It's interesting to note how running in a debugger can change how the JIT operates.

This just goes to show how dangerous it is to do your testing in the IDE. Running from the IDE (via F5) attaches a debugger to your app. Even when you're running code in release mode, you still won't be using the same application that your users will be running because the debugger is attached and the JIT optimizer operates differently.

The bottom line is that the best way to do effective testing is to run the application the same way your users will: from the desktop or command line.