Skip to content
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

Update GitHub action to handle the duplicate TypeLoadException issue #3025

Merged
merged 1 commit into from
Nov 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions tools/issue-mgmt/CloseDupIssues.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,36 @@ foreach ($item in $issues)

Write-Host "Issue: $root_url/$number" -ForegroundColor Green

if ($title.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
$body.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
$body -match 'PSReadLine: 2\.\d\.\d(-\w+)?' -or
$body -match 'PSReadline version: 2\.\d\.\d(-\w+)?' -or
$body -match 'PowerShell: 7\.\d\.\d' -or
$body -match 'PS version: 7\.\d\.\d')
if ($body.Contains("System.TypeLoadException: Could not load type 'System.Management.Automation.Subsystem.PredictionResult'") -and
$body -match 'PSReadLine: 2\.2\.0-beta[12]' -and
$body -match 'PowerShell: 7\.2\.0')
{
$comment = @'
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](https://www.powershellgallery.com/packages/PSReadLine/2.2.0-beta4). 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.
'@
}
elseif ($title.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
$body.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
$body -match 'PSReadLine: 2\.\d\.\d(-\w+)?' -or
$body -match 'PSReadline version: 2\.\d\.\d(-\w+)?' -or
$body -match 'PowerShell: 7\.\d\.\d' -or
$body -match 'PS version: 7\.\d\.\d')
{
## The issue reported a recent version of PSReadLine, so leave it as is.
continue
}

if ($body.Contains('System.ArgumentOutOfRangeException:') -and
$body.Contains('System.Console.SetCursorPosition(') -and
$body.Contains('Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(') -and
-not $body.Contains('Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender('))
elseif ($body.Contains('System.ArgumentOutOfRangeException:') -and
$body.Contains('System.Console.SetCursorPosition(') -and
$body.Contains('Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(') -and
-not $body.Contains('Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender('))
{
## The issue either reported an old version of PSReadLine, or provided no
## information about the version. In either case, it's likely a duplicate
Expand Down