Skip to content

Error on Preview 6 System.TypeLoadException: Could not load type 'System.Management.Automation.Subsystem.PredictionResult' #2511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
patrick-ryan1 opened this issue May 29, 2021 · 4 comments

Comments

@patrick-ryan1
Copy link

patrick-ryan1 commented May 29, 2021

## Environment
### Environment
PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0-preview.6
OS: Microsoft Windows 10.0.18363
BufferWidth: 156
BufferHeight: 40

script in $profile

$versionMinimum = [Version]'7.1.999'
if (($host.name -eq 'ConsoleHost') -and ($PSVersionTable.PSVersion -gt $versionMinimum)) {
    Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
}
else {
    Set-PSReadLineOption -PredictionSource History -PredictionViewStyle ListView
}

Import-Module Terminal-Icons
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme Material

Exception Error:

Set-PSReadLineOption: C:\Users\USPARYA\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:5
Line |
   5 |      Set-PSReadLineOption -PredictionSource HistoryAndPlugin -Predicti …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load type 'System.Management.Automation.Subsystem.PredictionResult' from assembly 'Microsoft.PowerShell.PSReadLine.Polyfiller,
     | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Loading personal and system profiles took 1864ms.
❯❯ ~  10:50
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!

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() in Microsoft.PowerShell.PSReadLine2.dll:token 0x60004ca+0x0
   at Microsoft.PowerShell.PSConsoleReadLine.Prediction.Reset() in Microsoft.PowerShell.PSReadLine2.dll:token 0x600049b+0x7
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics) in Microsoft.PowerShell.PSReadLine2.dll:token 0x6000101+0x118
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken) in Microsoft.PowerShell.PSReadLine2.dll:token 0x60000fa+0x60

The script did not run when pasted into windows terminal running preview. Dunno.

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 29, 2021
@MostHated
Copy link

MostHated commented May 29, 2021

I am getting this as well on Linux:

Environment

PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0-preview.6
OS: Linux 5.11.0-7614-generic #15~1618626693~20.10~ecb25cd-Ubuntu SMP Thu Apr 22 16:00:45 UTC
BufferWidth: 155
BufferHeight: 22

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() in Microsoft.PowerShell.PSReadLine2.dll:token 0x60004ca+0x0
   at Microsoft.PowerShell.PSConsoleReadLine.Prediction.Reset() in Microsoft.PowerShell.PSReadLine2.dll:token 0x600049b+0x7
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics) in Microsoft.PowerShell.PSReadLine2.dll:token 0x6000101+0x118
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken) in Microsoft.PowerShell.PSReadLine2.dll:token 0x60000fa+0x60

@Nevember
Copy link

Nevember commented May 30, 2021

UPDATE

Users in a similar thread posted that the teams are aware of this issue:

PSReadLine 2.2.0-beta1 and 2.2.0-beta2 do not work with this preview of PowerShell due to breaking changes in the prediction interface. The upcoming PSReadLine 2.2.0-beta3 release will resolve this. Use PSReadLine 2.1.0 as the temporary workaround.


Happening with me as well. Seems to be exclusive to PowerShell 7.2.0-preview.6.
Reproed several times with "-noprofile" in order to rule out profile issues; additionally, I commented out lines in my profile.ps1 that dealt with PSReadLine. Occurred initially when updating PSReadLine on a preexisting Powershell 7.2.0-preview.6 install; attempted to mitigate with fresh installations of both, but the issue persisted.
Tested on completely new sessions. I have not yet restarted the computer.

Environment

'Output env data when error occurred:'

PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0-preview.6
OS: Microsoft Windows 10.0.21390
BufferWidth: 120
BufferHeight: 9001

Last 0 Keys

'The environment script for bug posts would not produce any output via the host session,'
'so I ran it on PS 7.1.3, the and changed the PS version below:'


PS version: 7.2.0-preview.6
PSReadline version: 2.2.0-beta2
os: 10.0.21390.1 (WinBuild.160101.0800)
PS file version: 7.1.3.0
HostName: ConsoleHost
BufferWidth: 120
BufferHeight: 9001

Exception report


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() in Microsoft.PowerShell.PSReadLine2.dll:token 0x60004ca+0x0
   at Microsoft.PowerShell.PSConsoleReadLine.Prediction.Reset() in Microsoft.PowerShell.PSReadLine2.dll:token 0x600049b+0x7
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics) in Microsoft.PowerShell.PSReadLine2.dll:token 0x6000101+0x118
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken) in Microsoft.PowerShell.PSReadLine2.dll:token 0x60000fa+0x60

Steps to reproduce

Install PSReadLine 2.2.0-beta2
Install PowerShell 7.2.0-preview.6
Launch an instance of pwsh v7.2.0-preview.6 by any means:
• Directly running the executable by navigating to its installation directory
• Via Start Menu shortcut
• From powershell.exe as $PathToPS72\pwsh.exe -noprofile
• From command prompt as %PathToPS72\pwsh.exe -noprofile
• As terminal within VS Studio Code
• As terminal within Windows Terminal

Expected behavior

Typical PowerShell startup behavior--without errors and with a typical prompt.
Subsequent commands should exhibit the usual PSRealLine behaviors.

Actual behavior

Upon launching any instance of PS 7.2.0-preview.6, the user is presented with the given errors and messages. The console remains open and responsive, though there is no prompt available.

The user can type commands; text remains white. Pressing Enter will run the command and the expected output will be displayed, after which the included error messages appear. Prompt never appears.

Tab completion seems to be functional, though upon pressing TAB, another error message appears. The user's typed text moves to the center of the console, the suggested completion appears to the right of that, and another error message block appears above these, at the top of the console. The original error message and the caret remain at the bottom of the screen.

PSReadLine seems to be behaving fine with PowerShell 7.1.3.

@vrdse
Copy link

vrdse commented May 30, 2021

Same issue for me after upgrading to preview 6. Initially, I had psreadline 2.2.0-beta1 installed, which throwed the same error as 2.2.0-beta2.

Environment

PSReadLine: 2.2.0-beta2
PowerShell: 7.2.0-preview.6
OS: Microsoft Windows 10.0.19043
BufferWidth: 120
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() in Microsoft.PowerShell.PSReadLine2.dll:token 0x60004ca+0x0
   at Microsoft.PowerShell.PSConsoleReadLine.Prediction.Reset() in Microsoft.PowerShell.PSReadLine2.dll:token 0x600049b+0x7
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics) in Microsoft.PowerShell.PSReadLine2.dll:token 0x6000101+0x118
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken) in Microsoft.PowerShell.PSReadLine2.dll:token 0x60000fa+0x60

@daxian-dbw
Copy link
Member

Thanks for reporting and using the preview version of PowerShell!
This is a duplicate of #2495. The powershell-7.2.0-preview.6 contains a release note for this:

PSReadLine 2.2.0-beta1 and 2.2.0-beta2 do not work with this preview of PowerShell due to breaking changes in the prediction interface. The upcoming PSReadLine 2.2.0-beta3 release will resolve this. Use PSReadLine 2.1.0 as the temporary workaround.

This was addressed by #2524. We will release 2.2.0-beta3 with this fix today or tomorrow.

@ghost ghost removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants