ISE Bug Locks Debugger

by May 16, 2014

There is an obscure bug in the PowerShell ISE that may dead-lock the debugger. It affects PowerShell version 3.0 and 4.0.

Here is a test script:

$test = @"
    Some lines
    of text
"@

$test 

Save this code as a script in your ISE editor, then set a breakpoint on the first line: click anywhere inside the first line and press F9. The line should now be colored red.

When you start the script, the debugger will halt at the breakpoint, and you can use F10 to step through the code. This all works as expected.

Now, add some blanks before the variable declaration:

   $test = @"
    Some lines
    of text
"@

$test 

When you now invoke the debugger, it will dead-lock, and the ISE will not recover. You are still able to save unsaved scripts, but you cannot stop the ISE runspace anymore.

The bug is triggered by indented script variables that define a here string.

Twitter This Tip! ReTweet this Tip!