Skip to content

Exception thrown from CalculateWhereAndWhatToRender #2298

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
achimismaili opened this issue Mar 11, 2021 · 6 comments
Closed

Exception thrown from CalculateWhereAndWhatToRender #2298

achimismaili opened this issue Mar 11, 2021 · 6 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@achimismaili
Copy link

Hello, today I upgraded to PnP.PowerShell 1.4.0 and in the middle of debugging in vscode, I was asked to tell you the following ...

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.md
Thank you!

Environment

PSReadLine: 2.2.0-beta2
PowerShell: 2021.2.2
OS: Microsoft Windows 10.0.19041
BufferWidth: 259

Last 200 Keys

 i n 5 Enter
 UpArrow Delete Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Enter
 g e t - p n p m i Tab Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow UpArrow UpArrow UpArrow UpArrow DownArrow Enter
 UpArrow Spacebar | Spacebar S e l e c t Spacebar E m a i l Enter
 UpArrow Home $ u Spacebar = Spacebar Enter
 A d d - p n p m i c Tab Tab Spacebar - Tab Spacebar R o t w e i n 5 Spacebar - Tab Spacebar $ u Enter
 UpArrow Ctrl+c UpArrow UpArrow UpArrow DownArrow Ctrl+LeftArrow Ctrl+LeftArrow Shift+Ctrl+RightArrow Shift+LeftArrow Shift+LeftArrow F o r e Tab a c h Spacebar Delete { Spacebar $ _ . Delete End Spacebar } Home Delete Delete Delete Delete Delete Enter
 UpArrow Home $ u Spacebar = Spacebar Enter
 UpArrow UpArrow UpArrow Enter
 DownArrow g e t - p n p w e b Enter
 DownArrow c l s Enter
 DownArrow g e t - p n p w e b Enter
 DownArrow F8 DownArrow F8 F8 DownArrow Ctrl+c DownArrow Ctrl+s

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 'top')
Actual value was 37.
   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender(Boolean cursorMovedToInitialPos, RenderData renderData, LineInfoForRendering& lineInfoForRendering)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

[DBG]: PS D:\code\DevOps\xxx\Functions\xxx\Deployment\Scripts>
fwd-i-search: _

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Mar 11, 2021
@achimismaili
Copy link
Author

achimismaili commented Mar 11, 2021

I think, the problem was caused by the following:

  1. I updated a module file .psm1 by introducing a new switch parameter "-WaitExist"
  2. Then I updated a script b.ps1, which imports the module and calls the command, where I added the -WaitExist parameter
  3. Then I saved b.ps1 and switched to the other vscode window, where the file a.ps1 was still open, that calls b.ps1
  4. Without having restarted the terminal in vscode, I started a debug session by running a.ps1
  5. a.ps1 called b.ps1 which was supposed to import the updated psm1 module, but because I did not restart the terminal, the terminal thought, it already has imported the right psm1, but that was the "not updated" old version without the switch. (When I update a psm1, I usually have to restart the powershell terminal to load the changes)
  6. I think, this could have caused the error I was supposed to report here.

hope that helps.

@iSazonov
Copy link

Maybe dup #2214

@daxian-dbw
Copy link
Member

So far, we have 6 reports of this issue. All of them happened in VS Code terminal (PowerShell integrated console that comes with the PowerShell VS Code extension), and it seems they usually happen during debugging a script.

@daxian-dbw daxian-dbw added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Mar 12, 2021
@daxian-dbw
Copy link
Member

7 reports so far, and all happen in VSCode terminal (PowerShell integrated console that comes with the PowerShell VS Code extension). I hope the pipeline thread rewriting work in PowerShell extension service could fix this too.

@daxian-dbw
Copy link
Member

The pipeline thread rewriting work was merged quite a while ago and has been out in the PS extension preview for some time. So far, we got no new report of this similar issue, so I assume this was fixed in PS extension preview. I will close this issue, but please try out the new PS extension and let us know if you ran into anything.

@schwinbp
Copy link

Plan: 113 to add, 0 to change, 0 to destroy.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
PS C:\dev\repos\cpe\Sandbox\network\SandboxSharedNetworkMUM>
fwd-i-search: _
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

Environment

PSReadLine: 2.4.0-beta0+923a890f2e7ea10465f3a80a2bc030121a1c2f68
PowerShell: 2024.5.2
OS: Microsoft Windows 10.0.22631
BufferWidth: 166
BufferHeight: 42

Last 24 Keys:

p p p p p p p p p p p p p p p p p p p p p Ctrl+s p p

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 'top')
Actual value was 43.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender(Boolean cursorMovedToInitialPos, RenderData renderData, LineInfoForRendering& lineInfoForRendering)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Render()
at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

PS C:\dev\repos\cpe\Sandbox\network\SandboxSharedNetworkMUM>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

4 participants