Skip to content

Lock bundled modules (especially PSReadLine) #1493

Closed
@andyleejordan

Description

@andyleejordan

Per PowerShell/vscode-powershell#3385 users can encounter incompatibility issues by installing newer versions of our dependencies since we do not lock PSES to the bundled version. This is unfortunate and causes more issues than we believe are fixed by picking up the latest installed version. We are going to change PSES to only load the bundled module so that we, the developers, can manually update and test our dependencies. In dire scenarios, users can still just overwrite the bundled module in the extension folder, and at that point will either be following our specific instructions for a workaround or going outside our supported scenarios.

private static readonly string ReadLineInitScript = $@"
[System.Diagnostics.DebuggerHidden()]
[System.Diagnostics.DebuggerStepThrough()]
param()
end {{
$module = Get-Module -ListAvailable PSReadLine |
Where-Object {{ $_.Version -ge '2.0.2' }} |
Sort-Object -Descending Version |
Select-Object -First 1
if (-not $module) {{
Import-Module '{_psReadLineModulePath.Replace("'", "''")}'
return [Microsoft.PowerShell.PSConsoleReadLine]
}}
Import-Module -ModuleInfo $module
return [Microsoft.PowerShell.PSConsoleReadLine]
}}";

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions