Scott Hanselman

PowerShell 7.2.0 - Could not load type System.Management.Automation.Subsystem.PredictionResult

November 04, 2021 Comment on this post [9] Posted in PowerShell
Sponsored By

My PowerShell upgraded to the new PowerShell 7.2.0 and it happened automatically since I get PowerShell from the Windows Store. However, my fancy prompt use PSReadLine with Predictive Autocomplete stopped working suddenly.

However, suddenly I started getting this error on every prompt.

Could not load type 'System.Management.Automation.Subsystem.PredictionResult' from assembly 'Microsoft.PowerShell.PSReadLine.Polyfiller, Version=, 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)

Well, you can see I'm using a Beta of PSReadLine 2.2:

### Environment
PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0

But I have failed to keep it up to date, and when I got into this state, I realized just because my prompt wasn't pretty (momentarily) I could update it with one line while still staying on the Beta Train.

Install-Module PSReadLine -AllowPrerelease -Force

Now I'm on 2.2.0-beta4 and all is well and I have my cool prediction history back!

Sponsor: Couchbase Capella DBaaS is flexible, full-featured and fully managed  with built-in access via K/V, SQL and full text search. It’s blazing fast, yet surprisingly affordable. Try Capella today for free.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
November 09, 2021 18:03
If you terminal is stuck in the error above (as in my case) and can't input any command, you can update to the latest PSReadLine using the following command from cmd:

pwsh.exe -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -AllowPrerelease"

November 10, 2021 0:22
getting the following error and can't install even with Admin access

Install-Package: Administrator rights are required to install or update. Log on to the computer with an account that has Administrator rights, and then try again, or install by adding "-Scope
CurrentUser" to your command. You can also try running the Windows PowerShell session with elevated rights (Run as Administrator).
November 10, 2021 2:57
Thanks Scott! You got me into this mess; I was sure you'd get me outta it!! :-)
November 10, 2021 2:59
Sergii, try this in your profile file.

Install-Module PSReadLine -AllowPrerelease -Force -Scope CurrentUser
November 10, 2021 7:56
For those who are still having trouble installing the updated version of PSReadLine even with the great suggestions by Kevin and Silviu:

    1. Remove your PowerShell profile file from `C:\Users\<user>\Documents\PowerShell\
    2. Run `Install-Module PSReadLine -AllowPrerelease -Force -Scope CurrentUser` in an Administrator PowerShell instance
    3. Reinstate your PowerShell profile
    4. Viola!
November 10, 2021 12:00
For those still having problems:

You may need a higher version of powershellGet:

1. Install-Module -Name PowerShellGet -Force
2. Exit the powershell and reopen it
3. Install-Module PSReadLine -AllowPrerelease -Force

November 12, 2021 2:03
Thanks Scott for sharing this great article, it was very helpful for me.
November 12, 2021 8:11
I just follow you YouTube video to setup my PowerShell with Windows Terminal before and also got this error message few days ago. It's so nice for you to provide the solution so soon. Thanks a lot!
November 13, 2021 18:09

This Is To Provide General Knowledge About the Body weight and Tips to decrese the weight.
Stay Fit and healthy.Weight Loss

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.