It's dangerous to code alone! Take this.

Knowledge Check - Debugging

1. True/False. You can attach a debugger to a program built in the Release configuration.

NOTE: This question is not answered directly in the chapter. That makes it a poor question to be asking here. I’m leaving this in here for now, since the book has the question there, but I’ll be removing it in future updates and you should feel free to skip this question.

True. It is a common mistake to think that you can only debug in the Debug configuration (after all, the name sort of implies that) but you can attach a debugger to any program. The Release configuration has optimized code that can sometimes make for a less effective debugging session, but it more or less works the same.

2. True/False. The debugger will suspend your program if an unhandled exception occurs.

True. When an exception is thrown, the debugger will suspend your program and give you a chance to inspect everything that is happening so that you can fix it.

3. True/False. In some cases, you can edit your source code while execution is paused and resume with the changes.

True. This is one of the debugger and Visual Studio’s nicest features. Not all situations allow for it. Take advantage of it when you can, but worst case, you close down your running program, make the edit, and recompile and rerun it.