Search code examples
powershellpowershell-2.0powergui

Why does "F5 - Start Debugging" ignore breakpoints in PowerGUI?


I'm not sure if I'm being a bit thick, but I have a simple script with three lines:

$iis = 90000
$name = "somesite"
Write-Host("Values are: $iis and $name")

If I set a breakpoint on any of these lines and hit the play button (F5 - start debugging) the script runs but the breakpoints are ignored.

If I start the script with F11 (step into) I can step through just fine, however hitting F5 to run to the next breakpoint again causes PowerGUI to ignore the breakpoints

The script I'm working on is substantial and I don't really want to have to F11 through every line of code.

Why would this be?

  • I'm running PowerGUI 2.2.0.1358 on Windows 7 64-bit Ultimate Edition.
  • I tried both the x64 and x32 versions of the PowerGUI script editor without success.
  • I'm also running the PowerGUI Script Editor as Administrator (launched using right-click on PowerGUI Script Editor shortcut and Run As Administrator)
  • My PowerShell execution policy is set to Unrestricted.

Solution

  • It looks like there's a problem with PowerShell and square brackets in folder and filenames.

    Both PowerGUI and PowerShell ISE won't hit breakpoint if the script being debugged resides in a folder with [ or ] in the name.