Skip to content

Commit ead84f9

Browse files
authored
Update GitHub action to handle the TypeLoadException issue (#3025)
1 parent e02b0da commit ead84f9

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

tools/issue-mgmt/CloseDupIssues.ps1

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,36 @@ foreach ($item in $issues)
4242

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

45-
if ($title.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
46-
$body.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
47-
$body -match 'PSReadLine: 2\.\d\.\d(-\w+)?' -or
48-
$body -match 'PSReadline version: 2\.\d\.\d(-\w+)?' -or
49-
$body -match 'PowerShell: 7\.\d\.\d' -or
50-
$body -match 'PS version: 7\.\d\.\d')
45+
if ($body.Contains("System.TypeLoadException: Could not load type 'System.Management.Automation.Subsystem.PredictionResult'") -and
46+
$body -match 'PSReadLine: 2\.2\.0-beta[12]' -and
47+
$body -match 'PowerShell: 7\.2\.0')
48+
{
49+
$comment = @'
50+
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:
51+
1. stop all instances of `pwsh`.
52+
2. from `cmd.exe` run: `pwsh -noprofile -command "Install-Module PSReadLine -AllowPrerelease -Force"`
53+
54+
--------
55+
56+
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:
57+
1. run `pwsh -noprofile -noninteractive` to start `pwsh` without loading PSReadLine
58+
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.
59+
'@
60+
}
61+
elseif ($title.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
62+
$body.Contains('https://github.com/PowerShell/PSReadLine/issues/new') -or
63+
$body -match 'PSReadLine: 2\.\d\.\d(-\w+)?' -or
64+
$body -match 'PSReadline version: 2\.\d\.\d(-\w+)?' -or
65+
$body -match 'PowerShell: 7\.\d\.\d' -or
66+
$body -match 'PS version: 7\.\d\.\d')
5167
{
5268
## The issue reported a recent version of PSReadLine, so leave it as is.
5369
continue
5470
}
55-
56-
if ($body.Contains('System.ArgumentOutOfRangeException:') -and
57-
$body.Contains('System.Console.SetCursorPosition(') -and
58-
$body.Contains('Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(') -and
59-
-not $body.Contains('Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender('))
71+
elseif ($body.Contains('System.ArgumentOutOfRangeException:') -and
72+
$body.Contains('System.Console.SetCursorPosition(') -and
73+
$body.Contains('Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(') -and
74+
-not $body.Contains('Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender('))
6075
{
6176
## The issue either reported an old version of PSReadLine, or provided no
6277
## information about the version. In either case, it's likely a duplicate

0 commit comments

Comments
 (0)