vscode-powershell: `PowerShellEditorServices.Commands.psd1` MissingMethodException
Hello,
The powershell terminal in v5.1 doesn’t start anymore: it stays stuck in “starting powershell”. This does not happen with the PS terminal in 7.1.3. In the editorServices.log, I have this message:
2021-04-15 12:25:32.467 +02:00 [ERR] Execution of the following command(s) completed with errors:
Import-Module C:\Users\UUUUUUUU\.vscode\extensions\ms-vscode.powershell-2021.2.2\modules\PowerShellEditorServices\Commands\PowerShellEditorServices.Commands.psd1
2021-04-15 12:25:32.586 +02:00 [FTL] unhandled exception
System.[vscode-powershell.log](https://github.com/PowerShell/PSScriptAnalyzer/files/6317403/vscode-powershell.log)
[EditorServices.log](https://github.com/PowerShell/PSScriptAnalyzer/files/6317404/EditorServices.log)
[powershell editor services.txt](https://github.com/PowerShell/PSScriptAnalyzer/files/6317405/powershell.editor.services.txt)
[StartEditorServices.log](https://github.com/PowerShell/PSScriptAnalyzer/files/6317406/StartEditorServices.log)
: Méthode introuvable : 'System.Threading.Tasks.ValueTask System.IO.Pipelines.PipeReader.CompleteAsync(System.Exception)'.
à OmniSharp.Extensions.JsonRpc.InputHandler.<ProcessInputStream>d__36.MoveNext()
à System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
à OmniSharp.Extensions.JsonRpc.InputHandler.ProcessInputStream(CancellationToken cancellationToken)
à OmniSharp.Extensions.JsonRpc.InputHandler.<Start>b__27_0()
à System.Reactive.Linq.QueryLanguage.StartAsyncImpl(Func`1 actionAsync, IScheduler scheduler)
Tried to downgrade to old vscode and addon version: same error. Logs vscode in diagnostic mode attached. Thx for support.
powershell editor services.txt StartEditorServices.log vscode-powershell.log EditorServices.log
Steps to reproduce
open VScode
open a PS script in VScode
message "starting powershell" appears at the bottom right of your code after a few seconds
Message =====> PowerShell Integrated Console v2021.2.2 <===== in the Terminal
Expected behavior
message "powershell" appears at the bottom right of your code after a few seconds
message =====> PowerShell Integrated Console v2021.2.2 <=====
PS C:\xxxxxxxxxx>
in the Terminal
Actual behavior
Message "starting powershell" appears at the bottom right of your code after a few seconds
no prompt in terminal, so no way to execute commands
Run a script displays this message:
_Cannot debug or run a PowerShell script until the PowerShell session has started. Wait for the PowerShell session to finish starting and try again.
source powershell (extension)
Environment data
VScode version:
Version : 1.55.2 (user setup)
Commit : 3c4e3df9e89829dce27b7b5c24508306b151f30d
Date : 2021-04-13T09:35:57.887Z
Electron : 11.3.0
Chrome : 87.0.4280.141
Node.js : 12.18.3
V8 : 8.7.220.31-electron.0
OS : Windows_NT x64 10.0.17763
Addon Powershell version: 2021.2.2
> $PSVersionTable (from windows powershell ISE)
Name Value
---- -----
PSVersion 5.1.17763.1490
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1490
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() } (from vscode with PS terminal 7.1.3
1.19.1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
Hello @andschwa
yes the first error with v2021.2.2 doesnt’t appear now. I agree that it is better to debug the one that is currently present with v2021.2.2. Unless v2021.2.2 is hidden by v2021.5.1 ! We’ll see if we can fix the DryIoc … 😉
I think this may be related to issues in general with the assemblies shipped for PowerShell 5.1 support. Our use of .NET 6 (because of our support of PowerShell 7.2.x) brought in a bug with
dotnet(https://github.com/dotnet/sdk/issues/18101) which caused #3395. I’ll get the workaround in place for that, or they’ll fix it upstream, and then we can test if it resolves this issue too.So it looks like there’s an issue between the version of the assembly you’re loading on your machine vs the one Editor Services expects (indirectly through a dependency).
Essentially it seems something deep down expects
System.IO.Pipelines.PipeReaderto have aCompleteAsync(System.Exception)method on it. But on your machine it’s resolving a version of the assembly that doesn’t have it.What’s strange about this is that the logs indicate that the relevant DLL was loaded from the extension’s path on your machine:
So basically you’re loading the version of the DLL we ship, but it’s breaking with the rest of the program and only for you. So I still don’t really understand what’s going on here.
Hi @rjmholt here the result from windows powershell 5.1: