Chapter 11. Debugging techniques
Debugging can be one of the most frustrating parts of toolmaking, and we feel it’s often because folks don’t have a consistent, methodical approach to debugging. That’s what we’re going to offer you in this chapter. We’ll even make a promise: If you follow our recommendations, you’ll find debugging to be infinitely less frustrating. We’ll even walk you through some real-life debugging examples to help drive home the point.
We feel that the entire universe of software bugs, at least the PowerShell universe, essentially comes down to one of two types: typos and logic errors.
Typos are straightforward enough: They’re what happen when you type something wrong. Maybe it’s a command name. Maybe you mistype a variable name. Maybe you forgot a closing quotation mark or curly bracket. Whatever the cause, typos are relatively easy to prevent (we’ll offer some tips shortly) and to solve, at least compared to their more sinister cousin, logic errors.