Skip to content

PowerShell 7.2-Preview.7 bombs in Windows Terminal with System.TypeLoadException #15673

Closed

Description

Prerequisites

Steps to reproduce

Just did the automatic Windows update to PowerShell 7.2 Preview.7.
Posh_WU_2021-06-25_9-34-08

  1. Click on Wndows "Start", then on the PowerShell 7.2 Preview shortcut.
  2. Windows Terminal opens, but PowerShell ends with an System.TypeLoadException: 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'.

Posh72prev72021-06-25_9-58-14

Expected behavior

To get to the PowerShell prompt without exceptions errors.

Actual behavior

trying to open PowerShell Preview:

PowerShell 7.2.0-preview.7
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Users\max_t>
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-preview.7
OS: Microsoft Windows 10.0.21390
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


### Environment data

```powershell
Microsoft Windows [Version 10.0.21390.2025]

Windows Terminal Preview: Version: 1.9.1523.0

Visuals

No response

Activity

  1. MaximoTrinidad commented on Jun 25, 2021

    @MaximoTrinidad
    Author

    This has been happening to me since PowerShell 7.2-preview.6:#15496
    But this issue was closed with the explanation: "This is a known issue that will be fixed when PSRL 2.2.0-beta3 drops".

  2. iSazonov commented on Jun 25, 2021

    @iSazonov
    Collaborator

    Yes, 2.2.0-beta3 is needed. Please report the issue in #15510

  3. MaximoTrinidad commented on Jun 25, 2021

    @MaximoTrinidad
    Author

    I'm trying to install PSRL 2.2.-beta3 with elevated privileges, but it is failing:

    pwsh -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -AllowPrerelease -Scope CurrentUser"
    Install-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9711
    Line |
    9711 |  … talledPackages = PackageManagement\Install-Package @PSBoundParameters
         |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         | 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).
    

    I will figure it out! :)

  4. MaximoTrinidad commented on Jun 25, 2021

    @MaximoTrinidad
    Author

    So, I can manually remove the PSReadline module folder from the 'C:\Program Files\PowerShell\7-preview\Modules" location.
    Now, I can open PowerShell 7.2-preview.7 without PSRL.

    I still trying to install the PSRL 2.2.0.-beta3... no luck with it! :(

  5. MaximoTrinidad commented on Jun 25, 2021

    @MaximoTrinidad
    Author

    Ilya (@iSazonov),

    Success!! ... But strange behavior to resolve this issue.

    I had to log on with the "Administrator" user-id in order to install PSReadLine 2.2.0-Beta3.
    Only then I can go back and sign on with my normal user-id and run PowerShell 7.2-Preview.7 without any issues in Windows Terminal.

    I'm good now! But have I notice that when I sign on with the Administrator ID, PowerShell will open the prompt outside Windows Terminal App. I never had to use the Administrator ID for anything, until now.

  6. iSazonov commented on Jun 26, 2021

    @iSazonov
    Collaborator

    Installing to C:\program files\ has always required elevated permissions.

  7. ghost closed this as completedon Jun 28, 2021
  8. aungminko93750 commented on Jun 28, 2021

    @aungminko93750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions