Skip to content

PowerShellEditorServices.Commands.psd1 MissingMethodException #3297

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

Closed
anankee26 opened this issue Apr 15, 2021 · 17 comments
Closed

PowerShellEditorServices.Commands.psd1 MissingMethodException #3297

anankee26 opened this issue Apr 15, 2021 · 17 comments
Labels
Area-Startup Bug: PowerShell 5.1 Bugs when using PowerShell 5.1. Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@anankee26
Copy link

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
@rjmholt rjmholt transferred this issue from PowerShell/PSScriptAnalyzer Apr 15, 2021
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 15, 2021
@rjmholt
Copy link
Contributor

rjmholt commented Apr 15, 2021

One unusual thing is that this is x86 Windows PowerShell running on a 64-bit Windows.

@anankee26 can you report the output of this: get-item 'hklm:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full'

@anankee26
Copy link
Author

anankee26 commented Apr 15, 2021

Hi @rjmholt
here the result from windows powershell 5.1:

PS H:\> Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\'

CBS           : 1
Install       : 1
InstallPath   : C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Release       : 461814
Servicing     : 0
TargetVersion : 4.0.0
Version       : 4.7.03190
PSPath        : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\
PSParentPath  : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4
PSChildName   : Full
PSDrive       : HKLM
PSProvider    : Microsoft.PowerShell.Core\Registry

@rjmholt
Copy link
Contributor

rjmholt commented Apr 15, 2021

@anankee26 do you get this error when running from 64-bit Windows PowerShell? (the one that isn't called Windows PowerShell (x86))

@anankee26
Copy link
Author

@rjmholt, no error with the powershell core 7.1.3 x64 installed next to the two windows powershell 5.1.
Switching from one to the other, inside vscode, allows me to have the terminal in 7.1.3 working.
I have two windows powershell : one in x86 (SysWOW64) and one in x64 (system32).
The blocking occurs only with the two windows powershell 5.1

This config was working a few weeks ago; the last time I used vscode to do powershell (not the exact date). When I tried to do it again at the beginning of this week: it didn't work anymore.

wps_x86
wps_x64
ps_switch

@SydneyhSmith SydneyhSmith added Area-Startup Issue-Bug A bug to squash. Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Apr 20, 2021
@anankee26
Copy link
Author

Hi,
same issue with new version of vscode:

Version : 1.56.2 (user setup)
Commit : 054a9295330880ed74ceaedda236253b4f39a335
Date : 2021-05-12T17:13:13.157Z
Electron : 12.0.4
Chrome : 89.0.4389.114
Node.js : 14.16.0
V8 : 8.9.255.24-electron.0
OS : Windows_NT x64 10.0.17763

EditorServices.log:

2021-05-18 09:16:06.288 +02:00 [INF] PowerShell runtime version: 5.1.17763.1852, edition: Desktop
2021-05-18 09:16:10.015 +02:00 [INF] highlight handler loaded
2021-05-18 09:16:10.710 +02:00 [ERR] Execution of the following command(s) completed with errors:

    Import-Module C:\Users\xxxxxxxxxxxxx\.vscode\extensions\ms-vscode.powershell-2021.2.2\modules\PowerShellEditorServices\Commands\PowerShellEditorServices.Commands.psd1

2021-05-18 09:16:10.829 +02:00 [FTL] unhandled exception
System.MissingMethodException: 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)
   à System.Reactive.Linq.QueryLanguage.StartAsyncImpl(Func`1 actionAsync, IScheduler scheduler)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label May 18, 2021
@rjmholt
Copy link
Contributor

rjmholt commented May 19, 2021

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.PipeReader to have a CompleteAsync(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:

2021-04-15 12:25:27.443 +02:00 [VRB] Assembly resolve event fired for System.IO.Pipelines, Version=4.0.2.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
2021-04-15 12:25:27.443 +02:00 [VRB] Loading System.IO.Pipelines, Version=4.0.2.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 from PSES dependency dir into LoadFile context
2021-04-15 12:25:27.458 +02:00 [VRB] Loaded 'System.IO.Pipelines, Version=4.0.2.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' from 'C:\Users\UUUUUUUU\.vscode\extensions\ms-vscode.powershell-2021.2.2\modules\PowerShellEditorServices\bin\Common\System.IO.Pipelines.dll'
2021-04-15 12:25:27.458 +02:00 [VRB] Assembly resolve event fired for System.IO.Pipelines, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
2021-04-15 12:25:27.458 +02:00 [VRB] Loading System.IO.Pipelines, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 from PSES dependency dir into LoadFile context

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.

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label May 27, 2021
@anankee26
Copy link
Author

hello,

I tried a complete uninstall of VScode (with profil deleted) and re-install in

Version: 1.56.2 (user setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.17763

with only the powershell add-on in 2021.5.1
then an uninstallation of PS 7.13

but nothing to do, still impossible to start windows powershell 5

now, with the new version of VsCode, I have this message that appears in the terminal at startup:

=====> PowerShell Integrated Console v2021.5.1 <=====

Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 246 in EndProcessing:
System.AggregateException: An error occurred while writing to logger(s). ---> DryIoc.ContainerException: code: Error.WaitForScopedServiceIsCreatedTimeoutExpired;
message: DryIoc has waited for the creation of the scoped (or singleton) service by 'other party' for the 5000 ticks without the completion. 
It means that either the 'other party' is the parallel thread which has started (!) but unable to finish the creation of the service in the provided amount of time. 
Or more likely the 'other party' is the same thread and there is an undetected recursive dependency or 
the scoped service creation is failed with the exception and the exception was catched (!) but you are trying to resolve the failed service again. 
For all those reasons DryIoc has a timeout to prevent the infinite waiting. 
You may change the default timeout via `Scope.WaitForScopedServiceIsCreatedTimeoutTicks=NewValue`
   à DryIoc.Throw.It(Int32 error, Object arg0, Object arg1, Object arg2, Object arg3)
   à DryIoc.Scope.WaitForItemIsSet(ImMapEntry`1 itemRef)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent,
Object[] args)
   à DryIoc.Interpreter.InterpretResolveMethod(IResolverContext resolver, IList`1 callArgs, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec)
   à DryIoc.Interpreter.<>c__DisplayClass3_0.<TryInterpretNestedLambda>b__0()
   à DryIoc.Interpreter.<>c__DisplayClass5_0`1.<ConvertFunc>b__0()
   à System.Lazy`1.CreateValue()
   à System.Lazy`1.LazyInitValue()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.LanguageServer.Server.Logging.LanguageServerLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|12_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter,
List`1& exceptions, TState& state)
   --- Fin de la trace de la pile d'exception interne ---
   à Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   à Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception,
Func`3 formatter)
   à Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   à OmniSharp.Extensions.JsonRpc.OutputHandler.<.ctor>b__13_3(Exception e)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions._.OnError(Exception error)
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Reactive.Stubs.<>c.<.cctor>b__2_1(Exception ex)
   à System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   à System.Reactive.Sink`1.ForwardOnError(Exception error)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions._.OnError(Exception error)
   à System.Reactive.Sink`2.OnError(Exception error)
   à System.Reactive.Linq.ObservableImpl.ThrowImmediate`1.Run(IObserver`1 observer)
   à System.Reactive.BasicProducer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à System.Reactive.Linq.ObservableImpl.Defer`1._.Run()
   à System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions.Run(_ sink)
   à System.Reactive.Concurrency.Scheduler.<>c__75`1.<ScheduleAction>b__75_0(IScheduler _, ValueTuple`2 tuple)
   à System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
   à System.Reactive.Concurrency.LocalScheduler.Schedule[TState](TState state, Func`3 action)
   à System.Reactive.Concurrency.Scheduler.ScheduleAction[TState](IScheduler scheduler, TState state, Action`1 action)
   à System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à OmniSharp.Extensions.JsonRpc.OutputHandler..ctor(PipeWriter pipeWriter, ISerializer serializer, IEnumerable`1 outputFilters, IScheduler scheduler, ILogger`1 logger, IActivityTracingStrategy activityTracingStrategy)
   à DryIoc.Interpreter.TryInterpretAndUnwrapContainerException(IResolverContext r, Expression expr, Boolean useFec, Object& result)
   à DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved)
   à DryIoc.Resolver.Resolve[TService](IResolver resolver, IfUnresolved ifUnresolved)
   à OmniSharp.Extensions.LanguageServer.Server.LanguageServer.<From>d__37.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.<StartAsync>d__14.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner.<CreateEditorServicesAndRunUntilShutdown>d__9.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()
---> (Exception interne #0) DryIoc.ContainerException: code: Error.WaitForScopedServiceIsCreatedTimeoutExpired;
message: DryIoc has waited for the creation of the scoped (or singleton) service by 'other party' for the 5000 ticks without the completion. 
It means that either the 'other party' is the parallel thread which has started (!) but unable to finish the creation of the service in the provided amount of time. 
Or more likely the 'other party' is the same thread and there is an undetected recursive dependency or 
the scoped service creation is failed with the exception and the exception was catched (!) but you are trying to resolve the failed service again. 
For all those reasons DryIoc has a timeout to prevent the infinite waiting. 
You may change the default timeout via `Scope.WaitForScopedServiceIsCreatedTimeoutTicks=NewValue`
   à DryIoc.Throw.It(Int32 error, Object arg0, Object arg1, Object arg2, Object arg3)
   à DryIoc.Scope.WaitForItemIsSet(ImMapEntry`1 itemRef)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent,
Object[] args)
   à DryIoc.Interpreter.InterpretResolveMethod(IResolverContext resolver, IList`1 callArgs, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec)
   à DryIoc.Interpreter.<>c__DisplayClass3_0.<TryInterpretNestedLambda>b__0()
   à DryIoc.Interpreter.<>c__DisplayClass5_0`1.<ConvertFunc>b__0()
   à System.Lazy`1.CreateValue()
   à System.Lazy`1.LazyInitValue()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.LanguageServer.Server.Logging.LanguageServerLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|12_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter,
List`1& exceptions, TState& state)<---

== Press any key to close terminal ==

and in editorservices.log

2021-06-09 13:31:37.907 +02:00 [FTL] unhandled exception
System.MissingMethodException: Méthode introuvable : 'System.Threading.Tasks.ValueTask`1<!0> System.Threading.Channels.ChannelReader`1.ReadAsync(System.Threading.CancellationToken)'.
   à OmniSharp.Extensions.JsonRpc.OutputHandler.<ProcessOutputStream>d__19.MoveNext()
   à System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   à OmniSharp.Extensions.JsonRpc.OutputHandler.ProcessOutputStream(CancellationToken cancellationToken)
   à System.Reactive.Linq.QueryLanguage.StartAsyncImpl(Func`1 actionAsync, IScheduler scheduler)

and in vscode-powershell.log

09/06/2021 13:31:26 [NORMAL] - Language server starting --
09/06/2021 13:31:26 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
09/06/2021 13:31:26 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\logs\1623238286-f0b5b86f-7dd9-4432-9804-c2dc9746791b1623238278012\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\sessions\PSES-VSCode-13388-189431' -FeatureFlags @() 
09/06/2021 13:31:26 [NORMAL] - Waiting for session file
09/06/2021 13:31:26 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\logs\1623238286-f0b5b86f-7dd9-4432-9804-c2dc9746791b1623238278012\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\sessions\PSES-VSCode-13388-189431' -FeatureFlags @() 
09/06/2021 13:31:26 [NORMAL] - powershell.exe started.
09/06/2021 13:31:36 [NORMAL] - Session file found
09/06/2021 13:31:36 [NORMAL] - Registering terminal close callback
09/06/2021 13:31:36 [NORMAL] - Registering terminal PID log callback
09/06/2021 13:31:36 [NORMAL] - powershell.exe PID: 16216
09/06/2021 13:31:36 [NORMAL] - Language server started.
09/06/2021 13:31:36 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_flsv0qkb.ykb","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_gpnegpby.ds5"}
09/06/2021 13:31:36 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_flsv0qkb.ykb...
09/06/2021 13:31:36 [NORMAL] - Language service connected.

I don't know where to look for a solution anymore...

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 9, 2021
@andyleejordan
Copy link
Member

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 (dotnet/sdk#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.

@andyleejordan andyleejordan added the Bug: PowerShell 5.1 Bugs when using PowerShell 5.1. label Jun 11, 2021
@andyleejordan
Copy link
Member

Hey @anankee26 can you try this insider build of the extension and see if it fixes your issue?
PowerShell-insiders.vsix.zip

@andyleejordan andyleejordan added Needs: Fix Verification Please verify the fix for us! and removed Needs: Maintainer Attention Maintainer attention needed! labels Jun 14, 2021
@andyleejordan andyleejordan added this to the Committed-vNext milestone Jun 14, 2021
@anankee26
Copy link
Author

Hello @andschwa

vscode update in

Version : 1.57.0 (user setup)
Commit : b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Date : 2021-06-09T17:18:42.354Z
Electron : 12.0.9
Chrome : 89.0.4389.128
Node.js : 14.16.0
V8 : 8.9.255.25-electron.0
OS : Windows_NT x64 10.0.17763
  • So, uninstalling the add-on powershell 2021.5.1
  • restart vscode
  • install add-on powershell from .vsix provided:
  • start terminal powerhell windows x64 5.1 always KO
  • start terminal powerhell x64 7.1.3 ok.
=====> PowerShell Integrated Console v2021.5.1 <=====

Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 246 in EndProcessing:
System.AggregateException: An error occurred while writing to logger(s). ---> DryIoc.ContainerException: code: Error.WaitForScopedServiceIsCreatedTimeoutExpired;
message: DryIoc has waited for the creation of the scoped (or singleton) service by 'other party' for the 5000 ticks without the completion. 
It means that either the 'other party' is the parallel thread which has started (!) but unable to finish the creation of the service in the provided amount of time. 
Or more likely the 'other party' is the same thread and there is an undetected recursive dependency or 
the scoped service creation is failed with the exception and the exception was catched (!) but you are trying to resolve the failed service again. 
For all those reasons DryIoc has a timeout to prevent the infinite waiting. 
You may change the default timeout via `Scope.WaitForScopedServiceIsCreatedTimeoutTicks=NewValue`
   à DryIoc.Throw.It(Int32 error, Object arg0, Object arg1, Object arg2, Object arg3)
   à DryIoc.Scope.WaitForItemIsSet(ImMapEntry`1 itemRef)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Interpreter.InterpretResolveMethod(IResolverContext resolver, IList`1 callArgs, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec)
   à DryIoc.Interpreter.<>c__DisplayClass3_0.<TryInterpretNestedLambda>b__0()
   à DryIoc.Interpreter.<>c__DisplayClass5_0`1.<ConvertFunc>b__0()
   à System.Lazy`1.CreateValue()
   à System.Lazy`1.LazyInitValue()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.LanguageServer.Server.Logging.LanguageServerLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|12_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter, List`1& exceptions, TState& state)
   --- Fin de la trace de la pile d'exception interne ---
   à Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   à Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   à OmniSharp.Extensions.JsonRpc.OutputHandler.<.ctor>b__13_3(Exception e)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions._.OnError(Exception error)
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Reactive.Stubs.<>c.<.cctor>b__2_1(Exception ex)
   à System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   à System.Reactive.Sink`1.ForwardOnError(Exception error)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions._.OnError(Exception error)
   à System.Reactive.Sink`2.OnError(Exception error)
   à System.Reactive.Linq.ObservableImpl.ThrowImmediate`1.Run(IObserver`1 observer)
   à System.Reactive.BasicProducer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à System.Reactive.Linq.ObservableImpl.Defer`1._.Run()
   à System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions.Run(_ sink)
   à System.Reactive.Concurrency.Scheduler.<>c__75`1.<ScheduleAction>b__75_0(IScheduler _, ValueTuple`2 tuple)
   à System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
   à System.Reactive.Concurrency.LocalScheduler.Schedule[TState](TState state, Func`3 action)
   à System.Reactive.Concurrency.Scheduler.ScheduleAction[TState](IScheduler scheduler, TState state, Action`1 action)
   à System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à OmniSharp.Extensions.JsonRpc.OutputHandler..ctor(PipeWriter pipeWriter, ISerializer serializer, IEnumerable`1 outputFilters, IScheduler scheduler, ILogger`1 logger, IActivityTracingStrategy activityTracingStrategy)
   à DryIoc.Interpreter.TryInterpretAndUnwrapContainerException(IResolverContext r, Expression expr, Boolean useFec, Object& result)
   à DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved)
   à DryIoc.Resolver.Resolve[TService](IResolver resolver, IfUnresolved ifUnresolved)
   à OmniSharp.Extensions.LanguageServer.Server.LanguageServer.<From>d__37.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.<StartAsync>d__14.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner.<CreateEditorServicesAndRunUntilShutdown>d__9.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
   à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   à Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()
---> (Exception interne #0) DryIoc.ContainerException: code: Error.WaitForScopedServiceIsCreatedTimeoutExpired;
message: DryIoc has waited for the creation of the scoped (or singleton) service by 'other party' for the 5000 ticks without the completion. 
It means that either the 'other party' is the parallel thread which has started (!) but unable to finish the creation of the service in the provided amount of time. 
Or more likely the 'other party' is the same thread and there is an undetected recursive dependency or 
the scoped service creation is failed with the exception and the exception was catched (!) but you are trying to resolve the failed service again. 
For all those reasons DryIoc has a timeout to prevent the infinite waiting. 
You may change the default timeout via `Scope.WaitForScopedServiceIsCreatedTimeoutTicks=NewValue`
   à DryIoc.Throw.It(Int32 error, Object arg0, Object arg1, Object arg2, Object arg3)
   à DryIoc.Scope.WaitForItemIsSet(ImMapEntry`1 itemRef)
   à DryIoc.Factory.GetExpressionOrDefault(Request request)
   à DryIoc.Container.ResolveAndCacheKeyed(Int32 serviceTypeHash, Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Object scopeName, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, Object serviceKey, IfUnresolved ifUnresolved, Type requiredServiceType, Request preResolveParent, Object[] args)
   à DryIoc.Interpreter.InterpretResolveMethod(IResolverContext resolver, IList`1 callArgs, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   à DryIoc.Interpreter.TryInterpretNestedLambdaBodyAndUnwrapException(IResolverContext r, Expression bodyExpr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec)
   à DryIoc.Interpreter.<>c__DisplayClass3_0.<TryInterpretNestedLambda>b__0()
   à DryIoc.Interpreter.<>c__DisplayClass5_0`1.<ConvertFunc>b__0()
   à System.Lazy`1.CreateValue()
   à System.Lazy`1.LazyInitValue()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.LanguageServer.Server.Logging.LanguageServerLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   à Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|12_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter, List`1& exceptions, TState& state)<---


== Press any key to close terminal ==

EditorServices.log:

2021-06-15 10:33:14.168 +02:00 [FTL] unhandled exception
System.MissingMethodException: Méthode introuvable : 'System.Threading.Tasks.ValueTask`1<!0> System.Threading.Channels.ChannelReader`1.ReadAsync(System.Threading.CancellationToken)'.
   à OmniSharp.Extensions.JsonRpc.OutputHandler.<ProcessOutputStream>d__19.MoveNext()
   à System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   à OmniSharp.Extensions.JsonRpc.OutputHandler.ProcessOutputStream(CancellationToken cancellationToken)
   à System.Reactive.Linq.QueryLanguage.StartAsyncImpl(Func`1 actionAsync, IScheduler scheduler)

StartEditorServices.log = empty

vscode-powershell.log:

15/06/2021 10:33:06 [NORMAL] - Language server starting --
15/06/2021 10:33:06 [NORMAL] - Waiting for session file
15/06/2021 10:33:06 [NORMAL] - powershell.exe started.
15/06/2021 10:33:06 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
15/06/2021 10:33:06 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\logs\1623745986-4558ea8f-cb65-46c7-8f42-7a4dcc67dee91623745798695\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\sessions\PSES-VSCode-12260-536807' -FeatureFlags @() 
15/06/2021 10:33:06 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.5.1 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\logs\1623745986-4558ea8f-cb65-46c7-8f42-7a4dcc67dee91623745798695\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.5.1\sessions\PSES-VSCode-12260-536807' -FeatureFlags @() 
15/06/2021 10:33:12 [NORMAL] - Session file found
15/06/2021 10:33:12 [NORMAL] - Registering terminal PID log callback
15/06/2021 10:33:12 [NORMAL] - Registering terminal close callback
15/06/2021 10:33:12 [NORMAL] - powershell.exe PID: 17116
15/06/2021 10:33:12 [NORMAL] - Language server started.
15/06/2021 10:33:12 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_wpd1kcow.hx0","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_drnjyu4o.fbw"}
15/06/2021 10:33:12 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_wpd1kcow.hx0...
15/06/2021 10:33:12 [NORMAL] - Language service connected.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 15, 2021
@Guigz25
Copy link

Guigz25 commented Jun 15, 2021

Hi,
I'm having the same problem.
I tried to reinstall powershell from .vsix provided but still KO.

@andyleejordan
Copy link
Member

Hm, that DryIoc exception made me think for a minute this could be the deadlock fixed in dadhi/DryIoc@c1c89b6, but that fix made it's way into DryIoc 4.7.6, which was picked up by OmniSharp 0.19.2, which was picked up by PSES and this extension in v2021.5.1. Just FYI @rjmholt

@andyleejordan
Copy link
Member

But your error with v2021.5.1 is very different from your original error with v2021.2.2. I guess we should debug the former since the latter has gone away?

@anankee26
Copy link
Author

anankee26 commented Jun 16, 2021

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 ... ;-)

@andyleejordan andyleejordan changed the title PowerShellEditorServices.Commands.psd1 MissingMethodException PowerShellEditorServices.Commands.psd1 MissingMethodException Jun 24, 2021
@andyleejordan
Copy link
Member

@anankee26 I've lost track of what the bug is here. I'm going to mark this resolved because your original issue in v2021.2.2 as we discovered was resolved by updating to v2021.5.1. Could you please open a new bug for your new issue? Thanks!

@anankee26
Copy link
Author

OK, done in #3462

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jul 15, 2021
@andyleejordan
Copy link
Member

Thanks!!

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jul 15, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Bug: PowerShell 5.1 Bugs when using PowerShell 5.1. Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests

5 participants