PSReadLine 在升级到 PS 7.2 后抛出异常
PSReadLine throw exception after upgrading to PS 7.2
使用 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)
如 this thread 中所述,问题可以通过
解决
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:
1: stop all instances of pwsh.
2: from cmd.exe run:
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:
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.
使用 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)
如 this thread 中所述,问题可以通过
解决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:
1: stop all instances of pwsh.
2: from cmd.exe run:
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:
1: run
pwsh -noprofile -noninteractive
to start pwsh without loading PSReadLine2: 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.