Skip to content

System.ArgumentOutOfRangeException when using Out-GridView #2152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janegilring opened this issue Aug 24, 2019 · 7 comments
Closed

System.ArgumentOutOfRangeException when using Out-GridView #2152

janegilring opened this issue Aug 24, 2019 · 7 comments
Labels
Area-PSReadLine Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.

Comments

@janegilring
Copy link
Contributor

Issue Description

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.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerShell.EditorServices.EditorServicesPSHostUserInterface.d__95.MoveNext()

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18362
VSCode 1.37.1
PowerShell Extension Version 2019.5.0

PowerShell Information

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

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
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 24, 2019
@janegilring
Copy link
Contributor Author

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.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerShell.EditorServices.EditorServicesPSHostUserInterface.d__95.MoveNext()

PS Git:> Domain specific\Azure\sample.ps1"
The string is missing the terminator: ".
At line:0 char:0

@SydneyhSmith
Copy link
Collaborator

@janegilring thanks for reporting this it looks like you are hitting the same issue as #702

@SydneyhSmith
Copy link
Collaborator

@janegilring are you able to reproduce this issue in our Preview Extension?...that extension has PSReadline support which may solve this issue

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Aug 27, 2019
@janegilring
Copy link
Contributor Author

@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?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 1, 2019
@SydneyhSmith
Copy link
Collaborator

@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

@SydneyhSmith
Copy link
Collaborator

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

@SydneyhSmith SydneyhSmith added Resolution-Duplicate Will close automatically. Area-PSReadLine Issue-Bug A bug to squash. labels Sep 3, 2019
@ghost
Copy link

ghost commented Sep 4, 2019

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-PSReadLine Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.
Projects
None yet
Development

No branches or pull requests

2 participants