PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

PSConsoleReadLine.ReadLine - ArgumentOutOfRangeException

Open Kinjara opened this issue 8 years ago • 3 comments

If I try to read the encryption-state of my Azure-VM; I get the error that the key does not exists. To work-a-round this I want to try-catch that error and start the encryption process.

However I get the error 'something went wrong'

With kind regards, Sebastian

Try

{ #Get-AzureRmVmDiskEncryptionStatus -ResourceGroupName $RGName -VMName $VMName } catch { f($.Exception.Message -like "The Resource 'Microsoft.Compute/virtualMachines/") { Continue; } else { throw $.Exception } $Result = "Not encrypted" }$Result3;1 Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new


Last 200 Keys: Escape 1 3 ; 1 R

Exception: 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 -3. at System.Console.SetCursorPosition(Int32 left, Int32 top) at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor) at Microsoft.PowerShell.PSConsoleReadLine.ForceRender() at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Kinjara avatar Jul 10 '18 12:07 Kinjara

if I remove the 'else' it doesn't go into the error.

Kinjara avatar Jul 10 '18 12:07 Kinjara

This looks like a dupe of https://github.com/lzybkr/PSReadLine/issues/663. Is [Console]::BufferHeight less than the number of lines of input?

lzybkr avatar Jul 11 '18 20:07 lzybkr

Close as a duplicate of #663

daxian-dbw avatar Jul 19 '19 00:07 daxian-dbw