The following works fine in the Windows PowerShell console host:
Connect-AzAccount -Credential $AzureCreds
Get-AzSubscription | Out-GridView -PassThru -Title 'Select subscription to operate against' | Set-AzContext
When I run the same in VS Code, I get the following error:
PS Git:> Get-AzSubscription | Out-GridView -PassThru -Title 'Select subscription to operate against' | Set-AzContext
An error occurred while reading input:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was 10.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.InsertInput(StringBuilder inputLine, Int32 promptStartCol, Int32 promptStartRow, String insertedInput, Int32 cursorIndex, Int32 insertIndex, Int32 replaceLength, Int32
finalCursorIndex)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerShell.EditorServices.EditorServicesPSHostUserInterface.
| Name | Version |
| --- | --- |
| Operating System | Windows_NT x64 10.0.18362 |
| VSCode | 1.37.1|
| PowerShell Extension Version | 2019.5.0 |
|Name|Value|
|---|---|
|PSVersion|5.1.18362.145|
|PSEdition|Desktop|
|PSCompatibleVersions|1.0 2.0 3.0 4.0 5.0 5.1.18362.145|
|BuildVersion|10.0.18362.145|
|CLRVersion|4.0.30319.42000|
|WSManStackVersion|3.0|
|PSRemotingProtocolVersion|2.3|
|SerializationVersion|1.1.0.1|
Visual Studio Code Extensions(Click to Expand)
|Extension|Author|Version|
|---|---|---|
|armsnippet|artofshell|0.7.0|
|azure-account|ms-vscode|0.8.4|
|azure-pipelines|ms-azure-devops|1.155.0|
|azurecli|ms-vscode|0.4.6|
|bracket-pair-colorizer-2|CoenraadS|0.0.28|
|code-settings-sync|Shan|3.4.2|
|gitblame|waderyan|3.0.1|
|githistory|donjayamanne|0.4.6|
|gitlens|eamodio|9.9.3|
|guides|spywhere|0.9.3|
|indent-rainbow|oderwat|7.4.0|
|markdown-all-in-one|yzhang|2.4.2|
|material-icon-theme|PKief|3.8.1|
|night-owl|sdras|1.1.3|
|powershell|ms-vscode|2019.5.0|
|powershellprotools|ironmansoftware|4.9.0|
|python|ms-python|2019.8.30787|
|rainbow-csv|mechatroner|1.2.0|
|remote-wsl|ms-vscode-remote|0.39.2|
|shell-launcher|Tyriar|0.3.0|
|swagger-viewer|Arjun|2.2.2|
|team|ms-vsts|1.149.2|
|terraform|mauve|1.3.12|
|vscode-azureappservice|ms-azuretools|0.15.0|
|vscode-azurefunctions|ms-azuretools|0.18.1|
|vscode-azurestorage|ms-azuretools|0.7.1|
|vscode-azureterraform|ms-azuretools|0.2.4|
|vscode-coverage-gutters|ryanluker|2.4.0|
|vscode-instant-markdown|dbankier|1.4.4|
|vscode-logicapps|ms-azuretools|0.2.11|
|vscode-markdownlint|DavidAnson|0.30.1|
|vscode-pandoc|DougFinke|0.0.8|
|vscode-peacock|johnpapa|3.1.4|
|vsliveshare|ms-vsliveshare|1.0.721|
Not sure if this is related, but the following command also works in Windows PowerShell, but fails in VS Code:
Get-AzVM -Name MGMT-AZ-01 | Invoke-AzVMRunCommand -CommandId RunPowerShellScript -ScriptPath "~\Git\PSDemo\Azure\sample.ps1"
PS Git:> Get-AzVM -Name MGMT-AZ-01 | Invoke-AzVMRunCommand -CommandId RunPowerShellScript -ScriptPath "~\Git\PSDemo\
An error occurred while reading input:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was 10.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.InsertInput(StringBuilder inputLine, Int32 promptStartCol, Int32 promptStartRow, String insertedInput, Int32 cursorIndex, Int32 insertIndex, Int32 replaceLength, Int32
finalCursorIndex)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerShell.EditorServices.EditorServicesPSHostUserInterface.
PS Git:> Domain specific\Azure\sample.ps1"
The string is missing the terminator: ".
At line:0 char:0
@janegilring thanks for reporting this it looks like you are hitting the same issue as #702
@janegilring are you able to reproduce this issue in our Preview Extension?...that extension has PSReadline support which may solve this issue
@SydneyhSmith I installed the preview extension, and when trying to reproduce using that version - the issue is gone. If I go back to the non-preview extension, the issue is back. Are there any timeline for when PSReadline support will be available in the non-preview extension?
@janegilring thanks for checking that, glad to hear you have a work-around option for now---we unfortunately dont have a committed deadline but it remains our top issue and one we are hoping will be solved by architecture changes we are currently implementing
Going to mark this as a duplicate and continue tracking this item with our existing issue that PSReadLine is not available in the main PowerShell Extension #1793
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.