Skip to content

PSReadline 2.0.2 error #1654

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
27Mikael opened this issue Jul 13, 2020 · 5 comments
Closed

PSReadline 2.0.2 error #1654

27Mikael opened this issue Jul 13, 2020 · 5 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@27Mikael
Copy link

Environment

PSReadLine: 2.0.2
PowerShell: 5.1.18362.752
OS: Microsoft Windows 10.0.18363
Last 200 Keys

 0 2 0 . 6 . 9 1 3 5 0 \ p y t h o n F i l e s \ l i b \ p y t h o n \ d e b u g p y \ l a u n c h e r ' Spacebar ' 5 2 0 2 4 ' Spacebar ' - - ' Spacebar ' c : \ U s e r s \ M i c h a e l Spacebar K a n k u \ D e s k t o p \ s c r i p t s \ s o r t e r \ s h u t t l e . p y ' Spacebar Enter
 Spacebar c d Spacebar ' c : \ U s e r s \ M i c h a e l Spacebar K a n k u \ D e s k t o p \ s c r i p t s \ s o r t e r ' ; Spacebar & Spacebar ' C : \ U s e r s \ M i c h a e l Spacebar K

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 22.
   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(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)


for i in length:
    g = -1
    g1 = g + 1
    print(ext[g1])

thats the line of code i ran
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jul 13, 2020
@daxian-dbw
Copy link
Member

@H3pha3st0s Thanks for reporting the issue. We need some additional information for further investigation, so can you please run the following script in the same terminal where you ran into the issue and paste the result here? This script collects the environment data such as the host you are using, the windows/buffer size of your terminal. Thanks!

& {
    Set-StrictMode -Off
    $hostName = $Host.Name
    if ($hostName -eq "ConsoleHost" -and (Get-Command Get-CimInstance -ErrorAction SilentlyContinue)) {
        $id = $PID
        $inWindowsTerminal = $false
        while ($true) {
            $p = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId Like $id"
            if (!$p -or !$p.Name) { break }
            if ($p.Name -eq "WindowsTerminal.exe") { $inWindowsTerminal = $true; break }
            $id = $p.ParentProcessId
        }
        if ($inWindowsTerminal) { $hostName += " (Windows Terminal)" }
    }

    "`nPS version: $($PSVersionTable.PSVersion)"
    $m = Get-Module PSReadline
    $v = $m.Version; $pre = $m.PrivateData.PSData.Prerelease
    if ($pre) { $v = "$v-$pre" }
    "PSReadline version: $v"
    if ($IsLinux -or $IsMacOS) {
        "os: $(uname -a)"
    } else {
        "os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
    }
    "PS file version: $($name = if ($PSVersionTable.PSEdition -eq "Core") { "pwsh.dll" } else { "powershell.exe" }; (dir $pshome\$name).VersionInfo.FileVersion)"
    "HostName: $hostName"
    "BufferWidth: $([console]::BufferWidth)"
    "BufferHeight: $([console]::BufferHeight)`n"
}

@daxian-dbw daxian-dbw added Needs-Author Feedback and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Jul 13, 2020
@27Mikael
Copy link
Author

27Mikael commented Jul 20, 2020 via email

@daxian-dbw
Copy link
Member

daxian-dbw commented Jul 22, 2020

@H3pha3st0s I appreciate your response!
One more question, it looks to me you were using the VS Code terminal, can you please confirm if that's the case?

The exception reports the cursor top Actual value was 22.. That means the BufferHeight should be <= 22 when the exception happened. It's unfortunate that the available information so far cannot help move the investigation forward, but I do appreciate your help in providing those information!

@27Mikael
Copy link
Author

27Mikael commented Jul 24, 2020 via email

@daxian-dbw
Copy link
Member

Close as a duplicate of #1758

@daxian-dbw daxian-dbw added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

2 participants