Vscode-powershell: PowerShell Integrated Terminal Issue

Created on 3 Jan 2018  路  13Comments  路  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version: MacOS High Sierra 10.13.2
  • VS Code version: 1.19.1
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable:

PSVersion 6.0.0-rc.2
PSEdition Core
GitCommitId v6.0.0-rc.2
OS Darwin 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.3...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

1.19.1
0759f77bb8d86658bc935a10a64f6182c5a1eeba
x64
1 5 1 0

Issue Description

I am experiencing a problem with the integrated terminal.

I can run a script x amount of times in a row, and then try and type in the PowerShell Integrated Terminal which will return something like this: ^[[18;49R and will continue to do so until I clear the whole line, at which point I can start typing normally again, then the terminal is instantly unresponsive after executing a command resulting in having to kill the terminal and open a new one each time.

Attached Logs

log.txt

Area-Integrated Console Issue-Bug

Most helpful comment

I can confirm that this has fixed all of my issues. Overjoyed!

Couldn't get the terminal to crash even if I tried!

All 13 comments

@GHRoss Thanks for taking the time to file this issue.

@tylerl0706 - we need to fix how we are determining the PS version on Linux/macOS. I've seen this error from a number of log files coming from macOS - including this one:

03/01/2018 18:21:57 [WARNING] - Method "GetVersionDetails" at line 153 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellVersionDetails.cs

    Failed to look up PowerShell version, defaulting to version 5.

    System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.PowerShell.EditorServices.PowerShellContext.<>c__56`1.<ExecuteScriptAndGetItem>b__56_0(PSObject pso)
       at System.Linq.Enumerable.SelectIListIterator`2.MoveNext()
       at System.Linq.Enumerable.<OfTypeIterator>d__32`1.MoveNext()
       at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.ExecuteScriptAndGetItem[TResult](String scriptToExecute, Runspace runspace, TResult defaultValue)
       at Microsoft.PowerShell.EditorServices.Session.PowerShellVersionDetails.GetVersionDetails(Runspace runspace, ILogger logger)

I'm not sure if that is causing the behavior that the OP sees but we should eliminate it. Not sure what problems defaulting to PS 5 on macOS might cause.

@rkeithhill I'll look into it! Thanks @GHRoss for the issue!

@GHRoss how are you running the script and what do you type in the Integrated Terminal?

@tylerl0706 This is probably the same issue affecting debugging. That escape sequence is what is emitted to stdin when Console.CursorTop or Left is called on Unix platforms. There will always be a risk that that escape sequence will bleed into input (this risk is acknowledged via comments in corefx) But the pending PR should make it exceedingly rare and resolve the hanging.

@GHRoss If you're feeling adventurous and would like to give us a hand testing out the potential fix, here's the build from appveyor

@SeeminglyScience That makes sense - and I agree with you. Do you think we should then close this as a dupe to one of the other issues? Or maybe add it to be resolved when finishing up https://github.com/PowerShell/PowerShellEditorServices/pull/592

@tylerl0706 I'd like to leave it open to confirm it's the same issue, but I'm pretty sure so it's up to you.

Now that I think about it you may want to close the vscode-powershell issues I listed as resolved in that PR. I'm not a maintainer here so I'm not sure if they'll actually close automatically.

If they're listed in the PR (Fixes #<issue-number>) then they should close automatically when the PR is merged.

Resolves #<issue> also seems to work too 馃檪 on https://github.com/PowerShell/PowerShellEditorServices/pull/592

@rkeithhill Good spot.

@tylerl0706 I run the script by pressing F5 and then any key on the keyboard will give me the unexpected output.

@SeeminglyScience I think you're right, I cannot currently debug on macOS without hitting a key between each step. Where would I put the contents of that zip file to test, please? I'm excited to see this (potentially) fixed, after hours of wasted opening and closing of the terminal!

@GHRoss The easiest way is to replace the contents of the PowerShellEditorServices folder in you extension folder with the contents of the one in this zip. More specifically:

  1. In the integrated console, type ii ((gmo PowerShellEditorServices.Commands).ModuleBase|Split-Path). That should open the PSES folder within the extension in your file explorer.

  2. Make sure all instances of VSCode are closed

  3. Copy the contents of the PowerShellEditorServices folder from the zip into the window opened in step 1

  4. If you get access denied errors, try running gps pwsh|? id -ne $pid|spps in a separate PowerShell window

I can confirm that this has fixed all of my issues. Overjoyed!

Couldn't get the terminal to crash even if I tried!

@tylerl0706 another issue I missed in the PR

Closing :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guidooliveira picture guidooliveira  路  3Comments

daviwil picture daviwil  路  4Comments

MiYanni picture MiYanni  路  3Comments

lukegriffith picture lukegriffith  路  3Comments

itfranck picture itfranck  路  3Comments