PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.67k stars 477 forks source link

Conditional breakpoints not working in remote sessions #2295

Open janegilring opened 4 years ago

janegilring commented 4 years ago

Issue Description

I am experiencing a problem with conditional breakpoints not working in remote sessions.

To reproduce: Enter-PSSession -ComputerName srv01

psedit C:\temp\demo.ps1

Set a conditional breakpoint such as $i -eq 42 Run script (F5)

The following message is present when the script is running:

[SRV01]: PS C:\Users\admin\Documents> Cannot bind parameter 'Action'. Cannot convert the "if ($i -eq 14) { break }" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
At line:0 char:0

The same conditional breakpoint works fine when running the same script locally.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18363
VSCode 1.40.0
PowerShell Extension Version 2019.11.0

PowerShell Information

Name Value
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.2.3
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand) |Extension|Author|Version| |---|---|---| |azure-account|ms-vscode|0.8.7| |azure-pipelines|ms-azure-devops|1.157.4| |azurecli|ms-vscode|0.4.6| |azurerm-vscode-tools|msazurermtools|0.8.2| |bracket-pair-colorizer-2|CoenraadS|0.0.28| |code-settings-sync|Shan|3.4.3| |gitblame|waderyan|3.0.1| |githistory|donjayamanne|0.4.6| |gitlens|eamodio|10.1.2| |guides|spywhere|0.9.3| |indent-rainbow|oderwat|7.4.0| |markdown-all-in-one|yzhang|2.5.1| |material-icon-theme|PKief|3.9.1| |night-owl|sdras|1.1.3| |powershell-preview|ms-vscode|2019.11.0| |python|ms-python|2019.10.44104| |rainbow-csv|mechatroner|1.3.1| |remote-containers|ms-vscode-remote|0.83.0| |remote-wsl|ms-vscode-remote|0.40.2| |shell-launcher|Tyriar|0.3.0| |swagger-viewer|Arjun|2.2.2| |team|ms-vsts|1.161.0| |terraform|mauve|1.4.0| |vscode-azureappservice|ms-azuretools|0.16.1| |vscode-azurefunctions|ms-azuretools|0.20.0| |vscode-azurestorage|ms-azuretools|0.7.2| |vscode-azureterraform|ms-azuretools|0.3.0| |vscode-coverage-gutters|ryanluker|2.4.2| |vscode-instant-markdown|dbankier|1.4.4| |vscode-logicapps|ms-azuretools|0.2.22| |vscode-markdownlint|DavidAnson|0.31.2| |vscode-pandoc|DougFinke|0.0.8| |vscode-peacock|johnpapa|3.2.0| |vscode-todo-highlight|wayou|1.0.4| |vsliveshare|ms-vsliveshare|1.0.1123|
rjmholt commented 4 years ago

The relevant code for this is here I think.

Not yet clear why this occurs since we explicitly create a ScriptBlock, but will see if I can reproduce.