Skip to content
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

Start withot debugging twice dumps all my env variables on terminal and powershell panics with "System.ArgumentOutOfRangeException" a lot of times #7436

Closed
jmwielandt opened this issue Sep 17, 2019 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@jmwielandt
Copy link

Environment data

  • VS Code version: 1.38.1
  • Extension version (available under the Extensions sidebar): 2019.9.34911
  • OS and version: Windows 10 Pro, 1903, 10.0.18362.356 (WinBuild.160101.0800)
  • Python version: 3.7.4 x64
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...):

image

No conda or sth else, just "vanilla" python.

Expected behaviour

image

Actual behaviour

Too long, better hidden
PowerShell 6.2.2
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS C:\Users\my_user_name\Desktop\normal_directory> & 'C:\Users\my_user_name\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '53011' 'c:\Users\my_user_name\Desktop\normal_directory\P4.py'
321
(1, 2, 3)
PS C:\Users\my_user_name\Desktop\normal_directory> cd 'c:\Users\my_user_name\Desktop\normal_directory'; ${env:--All my env variables are dumped here, but snip.--
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:

 e Ctrl+Alt+\ . v s c o d e Ctrl+Alt+\ e x t e n s i o n s Ctrl+Alt+\ m s - p y t h o n . p y t h o n - 2 0 1 9 . 9 . 3 4 9 1 1 Ctrl+Alt+\ p y t h o n F i l e s Ctrl+Alt+\ p t v s d _ l a u n c h e r . p y ' Space ' - - d e f a u l t ' Space ' - - n o d e b u g ' Space 
' - - c l i e n t ' Space ' - - h o s t ' Space ' l o c a l h o s t ' Space ' - - p o r t ' Space ' 5 3 0 1 5 ' Space ' c : Ctrl+Alt+\ 
U s e r s Ctrl+Alt+\ J o s e Ctrl+Alt+\ D e s k t o p Ctrl+Alt+\ W I E L A N D T _ J O S E Ctrl+Alt+\ P 4 . p y ' Space Enter



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

-----------------------------------------------------------------------
PS C:\Users\my_user_name\Desktop\normal_directory> cd 'c:\Users\my_user_name\Desktop\normal_directory'; ${env:--All my env variables are dumped here, but snip.--'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\my_user_name\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '53015' 'c:\Users\my_user_name\Desktop\WIELANDT_JOS
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:

 e Ctrl+Alt+\ . v s c o d e Ctrl+Alt+\ e x t e n s i o n s Ctrl+Alt+\ m s - p y t h o n . p y t h o n - 2 0 1 9 . 9 . 3 4 9 1 1 Ctrl+Alt+\ p y t h o n F i l e s Ctrl+Alt+\ p t v s d _ l a u n c h e r . p y ' Space ' - - d e f a u l t ' Space ' - - n o d e b u g ' Space 
' - - c l i e n t ' Space ' - - h o s t ' Space ' l o c a l h o s t ' Space ' - - p o r t ' Space ' 5 3 0 1 5 ' Space ' c : Ctrl+Alt+\ 
U s e r s Ctrl+Alt+\ J o s e Ctrl+Alt+\ D e s k t o p Ctrl+Alt+\ W I E L A N D T _ J O S E Ctrl+Alt+\ P 4 . p y ' Space Enter



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

-----------------------------------------------------------------------
PS C:\Users\my_user_name\Desktop\normal_directory> cd 'c:\Users\my_user_name\Desktop\normal_directory'; ${env:--All my env variables are dumped here, but snip.--; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\my_user_name\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '53015' 'c:\Users\my_user_name\Desktop\normal_directory
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:

 e Ctrl+Alt+\ . v s c o d e Ctrl+Alt+\ e x t e n s i o n s Ctrl+Alt+\ m s - p y t h o n . p y t h o n - 2 0 1 9 . 9 . 3 4 9 1 1 Ctrl+Alt+\ p y t h o n F i l e s Ctrl+Alt+\ p t v s d _ l a u n c h e r . p y ' Space ' - - d e f a u l t ' Space ' - - n o d e b u g ' Space 
' - - c l i e n t ' Space ' - - h o s t ' Space ' l o c a l h o s t ' Space ' - - p o r t ' Space ' 5 3 0 1 5 ' Space ' c : Ctrl+Alt+\ 
U s e r s Ctrl+Alt+\ J o s e Ctrl+Alt+\ D e s k t o p Ctrl+Alt+\ W I E L A N D T _ J O S E Ctrl+Alt+\ P 4 . p y ' Space Enter


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

-----------------------------------------------------------------------
PS C:\Users\my_user_name\Desktop\normal_directory> cd 'c:\Users\my_user_name\Desktop\normal_directory'; ${env:--All my env variables are dumped here, but snip.--; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\my_user_name\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '53015' 'c:\Users\my_user_name\Desktop\normal_directory\
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:

 e Ctrl+Alt+\ . v s c o d e Ctrl+Alt+\ e x t e n s i o n s Ctrl+Alt+\ m s - p y t h o n . p y t h o n - 2 0 1 9 . 9 . 3 4 9 1 1 Ctrl+Alt+\ p y t h o n F i l e s Ctrl+Alt+\ p t v s d _ l a u n c h e r . p y ' Space ' - - d e f a u l t ' Space ' - - n o d e b u g ' Space 
' - - c l i e n t ' Space ' - - h o s t ' Space ' l o c a l h o s t ' Space ' - - p o r t ' Space ' 5 3 0 1 5 ' Space ' c : Ctrl+Alt+\ 
U s e r s Ctrl+Alt+\ J o s e Ctrl+Alt+\ D e s k t o p Ctrl+Alt+\ W I E L A N D T _ J O S E Ctrl+Alt+\ P 4 . p y ' Space Enter


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

-----------------------------------------------------------------------

6 more times the same

-----------------------------------------------------------------------
PS C:\Users\my_user_name\Desktop\normal_directory> cd 'c:\Users\my_user_name\Desktop\normal_directory'; ${env:--All my env variables are dumped here, but snip.--; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\my_user_name\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '53015' 'c:\Users\my_user_name\Desktop\normal_directory\P4.py' 
321
(1, 2, 3)
PS C:\Users\my_user_name\Desktop\normal_directory>

Steps to reproduce:

  1. Run a python file with Ctrl + F5 / "Start Without Debugging".
  2. Run it again with Ctrl + F5 / "Start Without Debugging". A simple hello world program make it happens.
print("hello world!")

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'ShowPlayIcon - control'
Starting Microsoft Python language server.
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> py -3.7 -c "import sys;print(sys.executable)"
> py -3.6 -c "import sys;print(sys.executable)"
> py -3 -c "import sys;print(sys.executable)"
> py -2 -c "import sys;print(sys.executable)"
> ~\AppData\Local\Programs\Python\Python37\python.exe -c "import sys;print(sys.executable)"
> conda info --json
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> ~\AppData\Local\Microsoft\WindowsApps\python3.exe c:\Users\my_user_name\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\interpreterInfo.py
> conda info --json
> conda --version
@jmwielandt jmwielandt added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 17, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 17, 2019
@kimadeline
Copy link

kimadeline commented Sep 17, 2019

Hi @jmwielandt 👋 Thank you for reaching out.

Sadly I couldn't reproduce your issue:

image

📋 Here's why all these variables are being displayed: When you run "Start Debugging" or "Start Without Debugging" all those ${env:*} debugging session variables are set behind the scenes by VS Code and/or the extension.
When you start debugging again in the same integrated terminal, a debugging session will be re-created ➡️ these variables will be inherited ➡️ the command being run is suddenly very, very long.

There is an experimental VS Code setting to start integrated terminal sessions with a clean environment, sadly it doesn't work on Windows otherwise I would've asked you to try it.

👉 There isn't anything we can do in the extension at the moment to fix this, so I will be closing this issue once you let me know if any of these workarounds work:

  • close the Python debug console every time you are done debugging (so that it re-creates a terminal next time)
  • use a different shell (git bash, cmd, another version of powershell-core or Windows Powershell)

Thanks!

@kimadeline kimadeline added the info-needed Issue requires more information from poster label Sep 17, 2019
@jmwielandt
Copy link
Author

Thanks for your answer, @kimadeline !

In fact, closing the Python debug console works, thanks!

Greetings~

PS: closing the python debug console fixed the problem for ever, i can't understand this ;-;

@ChaosGT
Copy link

ChaosGT commented Sep 18, 2019

I've got the same problem! I've prompt the bug under vscode.
microsoft/vscode#81023

@ChaosGT
Copy link

ChaosGT commented Sep 18, 2019

It is very easy to reproduce the bug:

  1. Open a single python file
  2. Choose Debug -> Start without debugging
    3. Repeat step 2 for several times
    The running command may occasionally include all the system environments, cause the shell get System.ArgumentOutOfRangeException.

@kimadeline
Copy link

Hi @ChaosGT 👋 thank you for reaching out. Please try one of the workarounds I mentioned above.

In the issue you opened in the VS Code repo you also wrote that sometimes VS Code will become unresponsive, if it happens again please open a separate issue for that.

Thanks!

@ghost ghost removed the triage label Sep 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants