Skip to content

pwsh 7.2.0 only working with PSReadLine 2.2.0-beta3, not beta 4 #3066

@JanRK

Description

@JanRK

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

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.yaml
Thank you!

### Environment
PSReadLine: 2.2.0-beta4
PowerShell: 7.2.0
OS: Microsoft Windows 10.0.19043
BufferWidth: 250
BufferHeight: 9001

Last 0 Keys:



### Exception

System.InvalidCastException: Unable to cast object of type 'System.Management.Automation.Language.ErrorExpressionAst' to type 'System.Management.Automation.Language.CommandAst'.
   at Microsoft.PowerShell.PSConsoleReadLine.GetArgumentForParameter(CommandParameterAst param)
   at Microsoft.PowerShell.PSConsoleReadLine.GetDefaultAddToHistoryOption(String line)
   at Microsoft.PowerShell.PSConsoleReadLine.GetAddToHistoryOption(String line)
   at Microsoft.PowerShell.PSConsoleReadLine.MaybeAddToHistory(String result, List`1 edits, Int32 undoEditIndex, Boolean fromDifferentSession, Boolean fromInitialRead)
   at Microsoft.PowerShell.PSConsoleReadLine.UpdateHistoryFromFile(IEnumerable`1 historyLines, Boolean fromDifferentSession, Boolean fromInitialRead)
   at Microsoft.PowerShell.PSConsoleReadLine.<ReadHistoryFile>b__102_0()
   at Microsoft.PowerShell.PSConsoleReadLine.WithHistoryFileMutexDo(Int32 timeout, Action action)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadHistoryFile()
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

image

Environment data

PS Version: 7.2.0
PS HostName: ConsoleHost
PSReadLine Version:
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 250
BufferHeight: 9001

Steps to reproduce

Upgrading to pwsh 7.2.0 and running

pwsh -noprofile -noninteractive -command "Install-Module -Name PSReadLine -AllowPrerelease -RequiredVersion 2.2.0-beta4 -Force -AllowClobber"

Installing beta3 makes pwsh work again

pwsh -noprofile -noninteractive -command "Install-Module -Name PSReadLine -AllowPrerelease -RequiredVersion 2.2.0-beta3 -Force -AllowClobber"

Expected behavior

Working pwsh

Actual behavior

Crashing pwsh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIt either shouldn't be doing this or needs an investigation.Resolution-Fixed

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions