Skip to content

Exception: System.IO.IOException: The parameter is incorrect. #1011

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
MahmoodShehab opened this issue Aug 27, 2019 · 6 comments
Closed

Exception: System.IO.IOException: The parameter is incorrect. #1011

MahmoodShehab opened this issue Aug 27, 2019 · 6 comments

Comments

@MahmoodShehab
Copy link

MahmoodShehab commented Aug 27, 2019

PS C:>
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new


Last 25 Keys:
LeftArrow c d ' Enter
Enter
c d \ Enter
Enter
Enter
Ctrl+c c d ' Enter
Enter
Ctrl+c c d \ Enter
Ctrl+l Ctrl+l

Exception:

System.IO.IOException: The parameter is incorrect.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.SetWindowPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

2019-08-27 07_49_25-Administrator_ Windows PowerShell

Environment

PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta2
os: 10.0.18362.356 (WinBuild.160101.0800)
PS file version: 10.0.18362.356 (WinBuild.160101.0800)
BufferWidth: 319
BufferHeight: 3000

@msftrncs
Copy link
Collaborator

@MahmoodShehab, are you able to reproduce this? If so, can you offer any more clues, and supply the data returned from this script?

 & {
    "PS version: $($PSVersionTable.PSVersion)"
    $v = (Get-Module PSReadline).Version
    $m = Get-Content "$(Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
    if ($m) {
        $v = "$v-" + $m.Matches[0].Groups[1].Value
    }
    "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)"
    "BufferWidth: $([console]::BufferWidth)"
    "BufferHeight: $([console]::BufferHeight)"
}

Thanks,

@msftrncs
Copy link
Collaborator

Possibly related to #991.

@MahmoodShehab
Copy link
Author

PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta2
os: 10.0.18362.356 (WinBuild.160101.0800)
PS file version: 10.0.18362.356 (WinBuild.160101.0800)
BufferWidth: 319
BufferHeight: 3000

@dipakyadav
Copy link

dipakyadav commented Sep 26, 2019

It happened with me as well!!

Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new


Last 189 Keys:
s s h Enter
s s h Space - - v e r s i o n Enter
UpArrow LeftArrow LeftArrow LeftArrow RightArrow RightArrow RightArrow Backspace Backspace Backspace Backspace Backspace Backspace LeftArrow Backspace Enter
c d Space D o w Tab Enter
s s h Space - i Space Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace s s h Space - i Space " p r a v e e n n a r w a l d o t c o m e c 2 . p e m " Space u b u n t u @ e c 2 - 1 3 - 2 3 4 - 2 3 9 - 6 5 . a p - s o u t h - 1 . c o m p u t e . a m a z o n a w s . c o m Enter
UpArrow Enter
DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter 11,2-9 All
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
Enter
UpArrow

Exception:

System.IO.IOException: The parameter is incorrect.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   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.HistoryRecall(Int32 direction)
   at Microsoft.PowerShell.PSConsoleReadLine.PreviousHistory(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

@WSLUser
Copy link

WSLUser commented Sep 26, 2019

For me this issue exists in ConEmu for pwsh. Regular powershell is just fine in ConEmu. pwsh works just fine outside of ConEmu and can run the script above mentioned above. In ConEmu, I get "handle is invalid" error for that script.

Edit: Having re-installed it and doing "refresh tasks", I can open a new dialog in ConEmu. However, this error still presents itself when nested inside of another session. For example, if I open a powershell session and enter pwsh from there, I get this error. If I use Git bash, then pwsh, I get this error, etc.

@daxian-dbw
Copy link
Member

daxian-dbw commented Jan 3, 2020

I took a closer look today, and found the original issue reported here (Ctrl+l causes exception thrown from Console.SetWindowPosition) had already been fixed by #790, which changed the implementation of ClearScreen from using Console.ScrollBuffer, console.SetCursorPosition and console.SetWindowPosition to applying the escape sequence "0x1b[2J".

That change was included in 2.0.0-beta4 and newer versions, so for those who ran into this issue, please try out the latest 2.0.0-rc1 from PowerShell Gallery.


@dipakyadav The issue you report is different (exception thrown from PSConsoleReadLine.ReallyRender). There has been lots of fixes around ReallyRender since 2.0.0-beta5, and I believe the issue was fixed too. Please try out the 2.0.0-rc1 from PowerShell Gallery.


@WSLUser It's not clear to me what issue you ran into. It sounds to me that you had trouble running the script in #1011 (comment). If that's the case, please open a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants