You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add -LiteralPath parameter to Set-PSBreakpoint #7995
Set-PSBreakpoint currently doesn't have a -LiteralPath parameter to set breakpoints in scripts. This means that setting a breakpoint in strangely named files like hello [there].ps1 or on *nix whoisth*s?.ps1 is harder than it should be.
Set-PSBreakpoint doesn't have a path parameter either. It just has -Script (which is poorly named, given the confusion with the ScriptBlock type).
To resolve this, I propose the following:
Treat paths passed into Get-PSBreakpoint and Set-PSBreakpoint as literal paths.
Update the -Script parameter on those cmdlets to accept pipeline input by property name.
Add PSPath as a parameter alias for the -Script parameter on each of those cmdlets.
Consider renaming -Script as -FilePath to match other PowerShell cmdlets that accept a literal path with no wildcard support, and add -Script as an alias for backwards compatibility.
Consider adding a -Script (-FilePath) parameter that accepts pipeline input by property value with a PSPath alias in a new parameter set that would be added to Enable-/Disable-/Remove-PSBreakpoint to make it easier for users to turn breakpoints on or off or remove them according to their path with less pipelining.
Rationale:
Since the -Script parameter (or -FilePath parameter if we rename it) accepts multiple values, it is trivial for users who actually want to set a breakpoint on multiple files to do so using other cmdlets that support wildcard paths, in a pipeline.
Today if someone wants to get/set/enable/disable/remove a breakpoint on multiple files, since -Script does not support pipeline input, and since that parameter isn't on the enable/disable/remove cmdlets, it is much harder than it should be to do that, requiring all files to be in the same folder or using a loop to set the breakpoints. These changes would make that much easier.
As for risk, these are breakpoint cmdlets, which are intended for interactive use. Someone could have an automated process to set breakpoints on a bunch of files though as part of their dev/test cycle, and be interrupted by such a change. Still, that's dev/test, not production, and I think the risk is pretty low and worth considering.
The breakpoints that are created are associated with actual files, not wildcards,
I sincerely doubt setting a breakpoint using a wildcard adds value today. It certainly doesn't for me, and if it does for others, it's limited to a single folder (i.e. if you want to limit breakpoints to your module, you need to use pipelines/other commands anyway to get all of the files in a folder hierarchy). Also, since it results in one breakpoint being created per file that matches the wildcard, it's not that user friendly. The only use case I can come up with where I might restrict breakpoints to certain files would be if I'm debugging a module and I want to scope breakpoints to all files within that module, which means structure, which means pipelining actual files, not wildcards.
Good point on not needing wildcard support. So OK, only need a Path parameter with the appropriate pipeline bindings and aliases for PSPath and Script.
Wouldn't it be nice if a -Path parameter (perhaps with a certain attribute) implicitly included a -LiteralPath parameter. I'm sure there are flaws to that idea and here's probably a bad place to discuss it all in full, but just felt I should blurt it out.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Activity
KirkMunro commentedon Jul 11, 2019
Set-PSBreakpointdoesn't have a path parameter either. It just has-Script(which is poorly named, given the confusion with theScriptBlocktype).To resolve this, I propose the following:
Get-PSBreakpointandSet-PSBreakpointas literal paths.-Scriptparameter on those cmdlets to accept pipeline input by property name.PSPathas a parameter alias for the-Scriptparameter on each of those cmdlets.-Scriptas-FilePathto match other PowerShell cmdlets that accept a literal path with no wildcard support, and add-Scriptas an alias for backwards compatibility.-Script(-FilePath) parameter that accepts pipeline input by property value with aPSPathalias in a new parameter set that would be added toEnable-/Disable-/Remove-PSBreakpointto make it easier for users to turn breakpoints on or off or remove them according to their path with less pipelining.Rationale:
-Scriptparameter (or-FilePathparameter if we rename it) accepts multiple values, it is trivial for users who actually want to set a breakpoint on multiple files to do so using other cmdlets that support wildcard paths, in a pipeline.-Scriptdoes not support pipeline input, and since that parameter isn't on the enable/disable/remove cmdlets, it is much harder than it should be to do that, requiring all files to be in the same folder or using a loop to set the breakpoints. These changes would make that much easier.As for risk, these are breakpoint cmdlets, which are intended for interactive use. Someone could have an automated process to set breakpoints on a bunch of files though as part of their dev/test cycle, and be interrupted by such a change. Still, that's dev/test, not production, and I think the risk is pretty low and worth considering.
Thoughts?
rkeithhill commentedon Jul 11, 2019
Maybe these cmdlets should just define the normal
Path/LiteralPathparameters and configureScriptas an alias for one of the two?KirkMunro commentedon Jul 11, 2019
My hesitancy there is:
rkeithhill commentedon Jul 11, 2019
Good point on not needing wildcard support. So OK, only need a
Pathparameter with the appropriate pipeline bindings and aliases for PSPath and Script.rjmholt commentedon Jul 15, 2019
Wouldn't it be nice if a
-Pathparameter (perhaps with a certain attribute) implicitly included a-LiteralPathparameter. I'm sure there are flaws to that idea and here's probably a bad place to discuss it all in full, but just felt I should blurt it out.microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.