Skip to content

Use PSRL release and filter out previous betas #745

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

Merged
merged 13 commits into from
Sep 13, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class PSReadLinePromptContext : IPromptContext {
[System.Diagnostics.DebuggerHidden()]
[System.Diagnostics.DebuggerStepThrough()]
param()
return [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine(
return [Microsoft.PowerShell.PSConsoleReadLine, Microsoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null]::ReadLine(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkeithhill, @SeeminglyScience turns out:

  • PSCore 6.0 bundles and loaded PSReadLine.dll in $PSHome, so we need to use the assembly-qualified name of the type and we have to provide the version for it to work
  • Windows PowerShell doesn't like assembly-qualified names without the Culture and PublicKeyToken, so I had to add that too...........

But it works and we can take it out when PSCore 6.0 support is ended

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the bright side it's still a whole lot better than having to manually replace the DLL!

$Host.Runspace,
$ExecutionContext,
$args[0])";
Expand All @@ -31,7 +31,7 @@ internal class PSReadLinePromptContext : IPromptContext {
param()
end {
$module = Get-Module -ListAvailable PSReadLine |
Where-Object Version -ge '2.0.0' |
Where-Object Version -eq '2.0.0' |
Where-Object { $_.PrivateData.PSData.Prerelease -notin 'beta1','beta2' } |
Sort-Object -Descending Version |
Select-Object -First 1
Expand All @@ -40,7 +40,7 @@ internal class PSReadLinePromptContext : IPromptContext {
}

Import-Module -ModuleInfo $module
return 'Microsoft.PowerShell.PSConsoleReadLine' -as [type]
return [Microsoft.PowerShell.PSConsoleReadLine, Microsoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null]
}";

private readonly PowerShellContext _powerShellContext;
Expand Down