PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

PowerShell 7x64 cannot start properly

Open anthonyalvarez opened this issue 4 years ago • 1 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues, especially the pinned issues.

Exception report

Every time PowerShell 7 is launched, a error message is generated. Is this a problem caused by a $profiles? 

Please help.
Thank you. 

### Environment
PSReadLine: 2.2.0-beta1
PowerShell: 7.3.0
OS: Microsoft Windows 10.0.22621
BufferWidth: 152
BufferHeight: 30

Last 0 Keys


Exception

System.TypeLoadException: Could not load type 'System.Management.Automation.Subsystem.PredictionResult' from assembly '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.Prediction.Reset()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)


### Screenshot

![image](https://user-images.githubusercontent.com/1598435/203859503-04554399-ae83-4ae3-9cfb-6902375bb872.png)


### Environment data

```console
The Environment data script does not run in my PowerShell 7 terminal.

Steps to reproduce

Start Powershell

Expected behavior

Open powershell prompt

Actual behavior

Never get a proper PowerShell prompt but the terminal still accepts commands. Is this problem caused by bad command in one of the many $profile scripts?

anthonyalvarez avatar Nov 24 '22 20:11 anthonyalvarez

This issue was fixed in 2.2.0-beta3 version of PSReadLine. You can fix this by upgrading to the latest 2.2.6 version of PSReadLine. To upgrade, simply run Install-Module PSReadLine -AllowPrerelease -Force from your PowerShell console.


If you want to remove that beta version of PSReadLine and use the 2.1.0 version of PSReadLine that's shipped with PowerShell 7.2, you can:

  1. run pwsh -noprofile -noninteractive to start pwsh without loading PSReadLine
  2. run Uninstall-Module -Name PSReadLine -RequiredVersion <2.2.0-beta1 or 2.2.0-beta2> -AllowPrerelease to remove the module. Or, you can manually remove that module folder.

github-actions[bot] avatar Nov 24 '22 20:11 github-actions[bot]