I found a very annoying problem in PowerShell 3
It does not stop on breakpoints if new PowerShell process is created.
It was fine in PowerShell 2
Steps to reproduce:
Create MyScript.ps1 with the following content
function MyFunction()
{
Write-Host "Breakpoint should be hit"
}
Set-PSBreakpoint -Command MyFunction | Out-Null
MyFunction
And create MyScript.cmd with the following content
@echo off
echo PowerShell 2 stops on breakpoint PowerShell -Version 2 .\MyScript.ps1
echo PowerShell 3 does not stop on breakpoint PowerShell -Version 3 .\MyScript.ps1
Then run MyScript.cmd. You will see that when we run script in PowerShell 2 mode, it stops on the breakpoint we set. But this is not happening in PowerShell 3.
I could not find any explanations of that.
I found slightly similar bug: PowerShell V3 breakpoint bug
EDIT: Raised a bug for Microsoft, please vote for it https://connect.microsoft.com/PowerShell/feedback/details/767381/powershell-3-set-psbreakpoint-is-not-working-accross-different-powershell-exe-processes