Anyone who has been hosting the PowerShell engine has eagerly anticipated the release of PowerShell 2.0 and the promised debugger API.
The problem is though, that there isn’t much of an API.
Sure, there is a Debugger object in the Runspace class, where you can sign up for debugger events, like breakpoints having been updated or hit.
But that pretty much concludes the API part, at least as far as the documentation states.
While there are some debugging related cmdlets that you can use to set breakpoints, get a textual representation of the call stack etc., it is not really an API. Generating a code like
New-PSBreakpoint –script C:\Scripts\Test.ps1 –line 4
and running it is quite slow in comparison to making an API call. Evaluating return values is also much easier and faster than parsing textual error messages thrown at you by the engine.
Not having a proper API also prevents operations that any debugger usually offers, like “set execution point” or showing variable and their content depending on the context of a call stack.
So for the next version of PrimalScript and PrimalForms we will integrate whatever we can use into our existing debugger API we created here for PowerShell 1.0 and keep our fingers crossed that in PowerShell 3 we get an actual API from Microsoft.
1 comment on “PowerShell 2.0 and the missing debugging API”
Comments are closed.