You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ArgumentOutOfRangeException in Integrated Console when entering long input lines that wrap #702
The PowerShell Preview extension has PSReadLine support and should resolve this issue. If you're experiencing this, please give the preview extension a try. We've committed to delivering this fix in the stable extension release in January 2020.
-- ORIGINAL ISSUE --
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 3000.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.InsertInput(StringBuilder inputLine, Int32 promptStartCol, Int32 promptStartRow, String inser
tedInput, Int32 cursorIndex, Int32 insertIndex, Int32 replaceLength, Int32 finalCursorIndex)
at Microsoft.PowerShell.EditorServices.Console.ConsoleReadLine.<ReadLine>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Console.ConsoleService.<StartReplLoop>d__21.MoveNext()
changed the title [-]Exception Thrown when browsing command history in integrated terminal [/-][+]ArgumentOutOfRangeException in Integrated Console when entering long input lines that wrap[/+]on May 16, 2017
Looks like this only happens when the output exceeds the Console.BufferHeight and the user types a line longer than the Console.WindowWidth. PSReadline solves this problem by scrolling the buffer:
I'll implement the fix for this in June since it isn't a critical issue and only shows up in specific cases. Let me know if it is a big annoyance and I'll prioritize it sooner!
Goblenus your screenshot is of the PowerShell Stable extension. You want the "PowerShell Preview" extension. It's in the extension marketplace as well.
Goblenus, you are using an old version of PSReadLine. If you'd update to the latest 2.0.0-rc1 from PowerShellGallery, you will find that you do not need the PowerShell extension for Python (to the best of my knowledge). Even with the PowerShell Preview extension, you will need PSReadLine updated.
Carl Morris (@msftrncs)TylerLeonhardt I have just installed "PowerShell Preview" extension and check "PSReadLine" flag, but the same bug still happen.
Guys about this mess. I have no idea why I need installed "PowerShell Preview" extension, what is "PSReadLine" feature, I just want to start python debugging. Before it start to happen i haven't got installed "PowerShell Preview" or "PowerShell" extension. My last installation for vscode was "Visual Studio IntelliCode" with "Language Server".
Q1: Why the first start of debugging is everything fine??
Q2: Is i need installed "PowerShell" extension?
Q3: Why was it begin to happen?
One more thing, I have the solution (add "console": "integratedTerminal"), but what i done to make this bug happen.
Q1, I think it is because in order to step-debug python, the debugger needs to insure that the environment state is exactly the same between runs, so the second time, it is resetting various environment state, and the command, which is pasted in to PowerShell (more on this point) becomes very long, and triggers an issue in older version of PSReadLine.
Q2, as far as I know, you should not need PowerShell Extension, as that is for PowerShell development. However, I think the Python extension expects to utilize PowerShell as the CLI environment for the Python debugger. PowerShell, and its command line input tool, PSReadLine preexist on Windows installations, but the Python extension may require PowerShell Core if being used on a Linux environment.
I cannot understand Q3.
Again, I do not think you need the PowerShell Extension for Python debugging, but I think you would benefit from upgrading PSReadLine to the latest version, and then revert your launch.json file so that it does not have the "console": "integratedTerminal" option.
PowerShell is Microsoft's modern command line interface for Windows, now available on other operating systems as well. PSReadLine is an extension that improves the command line experience providing syntax highlighting, consistent multi-line command handling, enhanced history and more, that was originally a side project and is now a standard component of PowerShell. However, PSReadLine has gone through some issues as it has added more functionality, and most of those issues have only recently been fixed. The issue exception you commented with is one of the issues I know has been fixed in recent versions.
Bottom line. If you are on Windows, become familiar with PowerShell, and upgrade PSReadLine to the current version via the instructions in the PSReadLine repository, and then I think your Python debugging issues will go away.
Alternately, you could try the following in the PowerShell session that performs the debugging, remove-module psreadline and see if that helps or if it makes things worse. Don't worry, its a session level command and does not physically remove PSReadLine, its only removed until the current session ends.
Closing as PSReadLine is now available in the PowerShell Preview extension, which resolves this issue, tracking that PSReadLine is not available in the main PowerShell Extension here #1793
Hey I am running into this issue every time I input a quotation mark in the integrated terminal in visual studio code, seems to be working fine in the windows powershell
Can you open a new issue Mathew MacElwee (@mmac89)? We've made some large changes to the code after this issue so what you're seeing is likely different than the cause of this issue.
Activity
clmcgrath commentedon Apr 28, 2017
vscode-powershell.txt
EditorServices.txt
daviwil commentedon May 15, 2017
Thanks Chris! I'll take a look.
[-]Exception Thrown when browsing command history in integrated terminal [/-][+]ArgumentOutOfRangeException in Integrated Console when entering long input lines that wrap[/+]daviwil commentedon May 17, 2017
Looks like this only happens when the output exceeds the Console.BufferHeight and the user types a line longer than the Console.WindowWidth. PSReadline solves this problem by scrolling the buffer:
https://github.com/lzybkr/PSReadLine/blob/8e851bfadbbe7cd5d898b2f01eb6cf010f684a71/PSReadLine/Render.cs#L473
The cross-platform implementation of ScrollBuffer is here:
https://github.com/PowerShell/PowerShell/blob/7a55bf98b2370ab4817ab2533cb67673053ee446/src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs#L1055
I'll implement the fix for this in June since it isn't a critical issue and only shows up in specific cases. Let me know if it is a big annoyance and I'll prioritize it sooner!
clmcgrath commentedon May 17, 2017
Does simply installing psreadline fix this because I have it installed unless the no profile switch added by vscode disables this
daviwil commentedon May 17, 2017
Nah, PSReadline doesn't work inside of the Integrated Console right now. Hoping to get that added in June.
clmcgrath commentedon May 17, 2017
daviwil commentedon May 17, 2017
Me too!
89 remaining items
TylerLeonhardt commentedon Dec 21, 2019
Goblenus your screenshot is of the PowerShell Stable extension. You want the "PowerShell Preview" extension. It's in the extension marketplace as well.
msftrncs commentedon Dec 21, 2019
Goblenus, you are using an old version of PSReadLine. If you'd update to the latest 2.0.0-rc1 from PowerShellGallery, you will find that you do not need the PowerShell extension for Python (to the best of my knowledge). Even with the PowerShell Preview extension, you will need PSReadLine updated.
See the PSReadLine repository for more info.
Goblenus commentedon Dec 21, 2019
Carl Morris (@msftrncs) TylerLeonhardt I have just installed "PowerShell Preview" extension and check "PSReadLine" flag, but the same bug still happen.
Guys about this mess. I have no idea why I need installed "PowerShell Preview" extension, what is "PSReadLine" feature, I just want to start python debugging. Before it start to happen i haven't got installed "PowerShell Preview" or "PowerShell" extension. My last installation for vscode was "Visual Studio IntelliCode" with "Language Server".
Q1: Why the first start of debugging is everything fine??
Q2: Is i need installed "PowerShell" extension?
Q3: Why was it begin to happen?
One more thing, I have the solution (add "console": "integratedTerminal"), but what i done to make this bug happen.
msftrncs commentedon Dec 22, 2019
Goblenus,
Q1, I think it is because in order to step-debug python, the debugger needs to insure that the environment state is exactly the same between runs, so the second time, it is resetting various environment state, and the command, which is pasted in to PowerShell (more on this point) becomes very long, and triggers an issue in older version of PSReadLine.
Q2, as far as I know, you should not need PowerShell Extension, as that is for PowerShell development. However, I think the Python extension expects to utilize PowerShell as the CLI environment for the Python debugger. PowerShell, and its command line input tool, PSReadLine preexist on Windows installations, but the Python extension may require PowerShell Core if being used on a Linux environment.
I cannot understand Q3.
Again, I do not think you need the PowerShell Extension for Python debugging, but I think you would benefit from upgrading PSReadLine to the latest version, and then revert your launch.json file so that it does not have the
"console": "integratedTerminal"option.PowerShell is Microsoft's modern command line interface for Windows, now available on other operating systems as well. PSReadLine is an extension that improves the command line experience providing syntax highlighting, consistent multi-line command handling, enhanced history and more, that was originally a side project and is now a standard component of PowerShell. However, PSReadLine has gone through some issues as it has added more functionality, and most of those issues have only recently been fixed. The issue exception you commented with is one of the issues I know has been fixed in recent versions.
Bottom line. If you are on Windows, become familiar with PowerShell, and upgrade PSReadLine to the current version via the instructions in the PSReadLine repository, and then I think your Python debugging issues will go away.
Alternately, you could try the following in the PowerShell session that performs the debugging,
remove-module psreadlineand see if that helps or if it makes things worse. Don't worry, its a session level command and does not physically remove PSReadLine, its only removed until the current session ends.SydneyhSmith commentedon Feb 6, 2020
Closing as PSReadLine is now available in the PowerShell Preview extension, which resolves this issue, tracking that PSReadLine is not available in the main PowerShell Extension here #1793
mmac89 commentedon Oct 10, 2020
Hey I am running into this issue every time I input a quotation mark in the integrated terminal in visual studio code, seems to be working fine in the windows powershell
TylerLeonhardt commentedon Oct 15, 2020
Can you open a new issue Mathew MacElwee (@mmac89)? We've made some large changes to the code after this issue so what you're seeing is likely different than the cause of this issue.