使用PSReadLine升级到Powershell 7.2.0后引发的异常
### Environment
PSReadLine: 2.2.0-beta1
PowerShell: 7.2.0
OS: Microsoft Windows 10.0.22000
BufferWidth: 309
BufferHeight: 55
Last 0 Keys
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)发布于 2021-11-19 04:24:47
正如这条线中提到的,这个问题可以由
这个问题在2.2.0-beta3版本的PSReadLine中得到了修正。您可以通过升级到最新的2.2.0beta4版本的PSReadLine来解决这个问题。这样做的指示: 1:停止pwsh的所有实例。 2:从cmd.exe运行: pwsh -noprofile -command“安装-模块PSReadLine -AllowPrerelease -Force”
此外,如果您希望卸载以前的安装程序,请按照以下步骤操作
如果您想删除测试版的PSReadLine并使用随PowerShell 7.2附带的2.1.0版本的PSReadLine,您可以: 1:运行
pwsh -noprofile -noninteractive启动pwsh而不加载PSReadLine 2:运行Uninstall-Module -Name PSReadLine -RequiredVersion <2.2.0-beta1 or 2.2.0-beta2> -AllowPrerelease删除模块。或者,您可以手动删除该模块文件夹。
https://stackoverflow.com/questions/70029854
复制相似问题