Error after installing Powershell 7.2.0
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
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS C:\Users\p>
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.md
Thank you!
### Environment
PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0
OS: Microsoft Windows 10.0.19043
BufferWidth: 120
BufferHeight: 9001
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

### Environment data
```console
Cannot run the script, as cannot get a functional Powershell prompt anymore.
Steps to reproduce
I had Powershell 7.1.5 installed along with previous versions.
Today downloaded Powershell 7.2.0 x64. Running Windows 10 21H1 19043.1288.
As soon as I opened Windows Terminal got the exception. Opened Terminal both normal and as Adminstrator. Ctrl-C repeated the error, got no prompt where I could run the environment script.
Error also happens in Powershell 7 prompt, same as in Windows Terminal.
Expected behavior
Run 7.2.0 normally.
Actual behavior
The above exception happens.
Looks like same issue as #2987
Closing as #2987 is the same.
This issue was fixed in 2.2.0-beta3 version of PSReadLine. You can fix this by upgrading to the latest 2.2.0-beta4 version of PSReadLine. Instructions for doing so:
- stop all instances of
pwsh. - from
cmd.exerun:pwsh -noprofile -command "Install-Module PSReadLine -AllowPrerelease -Force"
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:
- run
pwsh -noprofile -noninteractiveto startpwshwithout loading PSReadLine - run
Uninstall-Module -Name PSReadLine -RequiredVersion <2.2.0-beta1 or 2.2.0-beta2> -AllowPrereleaseto remove the module. Or, you can manually remove that module folder.