PowerShell Set-PSBreakpoint bug in PowerShell 3?

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


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


About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

One Response to PowerShell Set-PSBreakpoint bug in PowerShell 3?

  1. Pingback: WTF: PowerShell 3 & Cygwin | mnaoumov.NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s