Skip to content

VSCode Integrated terminal in infinite restart loop #1967

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
MartinSGill opened this issue Nov 18, 2020 · 4 comments
Closed

VSCode Integrated terminal in infinite restart loop #1967

MartinSGill opened this issue Nov 18, 2020 · 4 comments

Comments

@MartinSGill
Copy link

VSCode Integrated terminal in infinite restart loop:

Steps to reproduce:

Start VSCode.
Open a powershell file.
Examine the integrated terminal output

Environment

PSReadLine: 2.2.0-beta1
PowerShell: 2020.6.0
OS: Microsoft Windows 10.0.19042
BufferWidth: 128
BufferHeight: 12

Last 0 Keys


VSCode:

Version: 1.51.1 (system setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19042

Powershell:

Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Options:

Get-PSReadLineOption

EditMode                               : Windows
AddToHistoryHandler                    : System.Func`2[System.String,System.Object]
HistoryNoDuplicates                    : True
HistorySavePath                        : C:\Users\marting.FENESTRAE\AppData\Roaming\Microsoft\Windows\PowerShell\P
                                         SReadLine\ConsoleHost_history.txt
HistorySaveStyle                       : SaveIncrementally
HistorySearchCaseSensitive             : False
HistorySearchCursorMovesToEnd          : True
MaximumHistoryCount                    : 4096
ContinuationPrompt                     : >>
ExtraPromptLineCount                   : 0
PromptText                             :
BellStyle                              : Visual
DingDuration                           : 50
DingTone                               : 1221
CommandsToValidateScriptBlockArguments : {ForEach-Object, %, Invoke-Command, icm…}
CommandValidationHandler               :
CompletionQueryItems                   : 100
MaximumKillRingCount                   : 10
ShowToolTips                           : True
ViModeIndicator                        : None
WordDelimiters                         : ;:,.[]{}()/\|^&*-=+
AnsiEscapeTimeout                      : 100
PredictionSource                       : History
PredictionViewStyle                    : InlineView
CommandColor                           : "`e[93m"
CommentColor                           : "`e[32m"
ContinuationPromptColor                : "`e[37m"
DefaultTokenColor                      : "`e[37m"
EmphasisColor                          : "`e[96m"
ErrorColor                             : "`e[91m"
InlinePredictionColor                  : "`e[38;5;238m"
KeywordColor                           : "`e[92m"
ListPredictionColor                    : "`e[33m"
ListPredictionSelectedColor            : "`e[48;5;238m"
MemberColor                            : "`e[97m"
NumberColor                            : "`e[97m"
OperatorColor                          : "`e[90m"
ParameterColor                         : "`e[90m"
SelectionColor                         : "`e[30;47m"
StringColor                            : "`e[36m"
TypeColor                              : "`e[37m"
VariableColor                          : "`e[92m"

Exception

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Microsoft.PowerShell.PSConsoleReadLine.PredictionViewBase.Reset()
   at Microsoft.PowerShell.PSConsoleReadLine.PredictionInlineView.Reset()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Nov 18, 2020
@daxian-dbw
Copy link
Member

@MartinSGill I cannot reproduce the issue, see my screen GIF below. Can you please provide the following information?

  1. Since your VSCode integrated consle cannot even start, where did you run Get-PSReadLineOption?
  2. Can you share the folder structure of the PSReadLine 2.2.0-beta1 that was used by the VSCode integrated console? For example , the following is the folder structure on my machine. Do you have the net461 and net5.0 folders available?
PS C:\> tree /F "C:\program files\powershell\7\Modules\PSReadLine\2.2.0"

Folder PATH listing for volume Local Disk
Volume serial number is 28D0-C244
C:\PROGRAM FILES\POWERSHELL\7\MODULES\PSREADLINE\2.2.0
│   Changes.txt
│   License.txt
│   Microsoft.PowerShell.PSReadLine2.dll
│   PSReadLine.format.ps1xml
│   PSReadLine.psd1
│   PSReadLine.psm1
│   SamplePSReadLineProfile.ps1
│   System.Runtime.InteropServices.RuntimeInformation.dll
│
├───net461
│       Microsoft.PowerShell.PSReadLine.Polyfiller.dll
│
└───net5.0
        Microsoft.PowerShell.PSReadLine.Polyfiller.dll

Screen GIF

demo

@MartinSGill
Copy link
Author

@daxian-dbw I did some more digging and I'm not sure this qualifies as a bug anymore, at least not one against PSReadline, although it might still be a bug against vscode-powershell.

From the days before VSCode supported PSReadline I had a condition in my profile to remove-module PSReadline -Force if the profile wasn't running in ConsoleHost. I never even realized that this still existed as PSReadline was happily working in VSCode.

Interestingly calling Remove-Module PSReadline -Force from the integrated terminal after my profile has loaded works without issue. It's just when I do it from my profile that it breaks.

I suspect that the vscode-powershell integration with PSReadline has a custom handler for unloading psreadline that doesn't work correctly if PSReadline is unloaded by the profile.

Not sure if that qualifies as a bug or not, truthfully.

@daxian-dbw
Copy link
Member

The vscode-powershell integrated console does have a custom handler for PSReadLine, and maybe that's why PSReadLine takes effect even after you run Remove-Module PSReadLine in the integrated console (shown in the screenshot below). Can you open an issue at https://github.com/PowerShell/PowerShellEditorServices for this unexpected behavior (rmo psreadline in profile vs. not in profile). The editor service maintainers can decided whether this qualifies a bug.

image

@daxian-dbw
Copy link
Member

@MartinSGill Given that this is more of a PowerShell vscode extension issue, I will close the issue here. But it would be nice if you can open an issue in the PowerShellEditorServices repo and let it be triaged. Thanks!

@ghost ghost removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants