Skip to content

Exception encountered starting EditorServices (DryIoc has waited for the creation of the scoped) #3462

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 Jul 15, 2021 · 51 comments
Assignees
Labels
Area-Startup Bug: PowerShell 5.1 Bugs when using PowerShell 5.1. Issue-Bug A bug to squash. Resolution-Inactive Will close automatically.

Comments

@anankee26
Copy link

anankee26 commented Jul 15, 2021

hello,

With reference to Originally posted by @anankee26 in #3297 (comment)

Powershell Windows terminal 5.1 doesn't start in vscode but ok with PS 7.1

Version : 1.58.1 (user setup)
Commit : 2aeda6b18e13c4f4f9edf6667158a6b8d408874b
Date : 2021-07-13T06:58:28.115Z
Electron : 12.0.13
Chrome : 89.0.4389.128
Node.js : 14.16.0
V8 : 8.9.255.25-electron.0
OS : Windows_NT x64 10.0.17763

with the powershell add-on in 2021.6.2

This message that appears in the terminal at startup:

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

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()
   à System.Lazy`1.get_Value()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification(IRequest params)
   à OmniSharp.Extensions.LanguageServer.Protocol.LanguageProtocolProxy.SendNotification(IRequest request)
   à 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.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.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception)
   à System.Reactive.ExceptionHelpers.Throw(Exception exception)
   à System.Reactive.Stubs.<>c.<.cctor>b__2_1(Exception ex)
   à System.Reactive.AnonymousSafeObserver`1.OnError(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.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   à System.Reactive.Sink`2.Run(IObservable`1 source)
   à System.Reactive.Linq.ObservableImpl.Defer`1._.Run()
   à System.Reactive.Linq.ObservableImpl.Defer`1.Run(_ sink)
   à System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   à System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   à System.Reactive.Sink`2.Run(IObservable`1 source)
   à System.Reactive.Linq.ObservableImpl.Do`1.Actions.Run(_ sink)
   à System.Reactive.Producer`2.<>c.<SubscribeRaw>b__1_0(ValueTuple`2 tuple)
   à 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)
   à System.Reactive.Producer`2.Subscribe(IObserver`1 observer)
   à System.ObservableExtensions.Subscribe[T](IObservable`1 source)
   à 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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   à 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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   à 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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   à 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()
   à System.Lazy`1.get_Value()
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification[T](String method, T params)
   à OmniSharp.Extensions.JsonRpc.ResponseRouter.SendNotification(IRequest params)
   à OmniSharp.Extensions.LanguageServer.Protocol.LanguageProtocolProxy.SendNotification(IRequest request)
   à 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)<---

and in editorservices.log

2021-07-15 10:07:32.926 +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

15/07/2021 10:07:25 [NORMAL] - Language server starting --
15/07/2021 10:07:25 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336445-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-960386' -FeatureFlags @() 
15/07/2021 10:07:25 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
15/07/2021 10:07:25 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336445-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-960386' -FeatureFlags @() 
15/07/2021 10:07:25 [NORMAL] - Waiting for session file
15/07/2021 10:07:25 [NORMAL] - powershell.exe started.
15/07/2021 10:07:31 [NORMAL] - Session file found
15/07/2021 10:07:31 [NORMAL] - Registering terminal close callback
15/07/2021 10:07:31 [NORMAL] - Registering terminal PID log callback
15/07/2021 10:07:31 [NORMAL] - powershell.exe PID: 11468
15/07/2021 10:07:31 [NORMAL] - Language server started.
15/07/2021 10:07:31 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_j5ninm25.fjz","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_gxwljakz.em2"}
15/07/2021 10:07:31 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_j5ninm25.fjz...
15/07/2021 10:07:31 [NORMAL] - Language service connected.

Output terminal:

15/07/2021 10:03:18 [NORMAL] - Visual Studio Code v1.58.1 64-bit
15/07/2021 10:03:18 [NORMAL] - PowerShell Extension v2021.6.2
15/07/2021 10:03:18 [NORMAL] - Operating System: Windows 64-bit
15/07/2021 10:03:18 [NORMAL] - Language server starting --
15/07/2021 10:03:18 [NORMAL] -     PowerShell executable: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
15/07/2021 10:03:18 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336198-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-286880' -FeatureFlags @() 
15/07/2021 10:03:18 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336198-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-286880' -FeatureFlags @() 
15/07/2021 10:03:18 [NORMAL] - powershell.exe started.
15/07/2021 10:03:18 [NORMAL] - Waiting for session file
15/07/2021 10:03:26 [NORMAL] - Session file found
15/07/2021 10:03:26 [NORMAL] - Registering terminal close callback
15/07/2021 10:03:26 [NORMAL] - Registering terminal PID log callback
15/07/2021 10:03:26 [NORMAL] - powershell.exe PID: 2868
15/07/2021 10:03:26 [NORMAL] - Language server started.
15/07/2021 10:03:26 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_nas2maqs.b0h","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_yi1ki3xa.tpn"}
15/07/2021 10:03:26 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_nas2maqs.b0h...
15/07/2021 10:03:26 [NORMAL] - Language service connected.
15/07/2021 10:05:30 [ERROR] - Could not start language service: 
15/07/2021 10:05:30 [ERROR] - Error: Connection to server got closed. Server will not be restarted.
15/07/2021 10:05:31 [NORMAL] - powershell.exe terminated or terminal UI was closed
15/07/2021 10:07:25 [NORMAL] - Shutting down language client...
15/07/2021 10:07:25 [NORMAL] - Language server starting --
15/07/2021 10:07:25 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
15/07/2021 10:07:25 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336445-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-960386' -FeatureFlags @() 
15/07/2021 10:07:25 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.6.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.6.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\logs\1626336445-48dbdd01-1952-4a1b-be13-e2e1351072541626336190022\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-2021.6.2\sessions\PSES-VSCode-17620-960386' -FeatureFlags @() 
15/07/2021 10:07:25 [NORMAL] - powershell.exe started.
15/07/2021 10:07:25 [NORMAL] - Waiting for session file
15/07/2021 10:07:31 [NORMAL] - Session file found
15/07/2021 10:07:31 [NORMAL] - Registering terminal close callback
15/07/2021 10:07:31 [NORMAL] - Registering terminal PID log callback
15/07/2021 10:07:31 [NORMAL] - powershell.exe PID: 11468
15/07/2021 10:07:31 [NORMAL] - Language server started.
15/07/2021 10:07:31 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_j5ninm25.fjz","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_gxwljakz.em2"}
15/07/2021 10:07:31 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_j5ninm25.fjz...
15/07/2021 10:07:31 [NORMAL] - Language service connected.

Thanks for support.

@andyleejordan
Copy link
Member

Hi,

Could you please provide more repro information? What code repository are you trying to use, what's your environment setup, what steps do I need to follow in order to reproduce this?

Thanks!

@andyleejordan andyleejordan added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Jul 20, 2021
@ghost
Copy link

ghost commented Aug 4, 2021

This issue is being closed as inactive, if this issue is still occurring it will be re-opened

@ghost ghost added the Resolution-Inactive Will close automatically. label Aug 4, 2021
@ghost ghost closed this as completed Aug 4, 2021
@anankee26
Copy link
Author

Hello,
Sorry pour the delay, I was on vacation.

When I run vscode (v1.59 today), i open a simple file .ps1 with a --echo "test"-- inside. Nothing else.
I use Gitlab community edition 13.7.3 (server) for repository ; locally, git version 2.29.2.windows.2 . I have remote-WSL v0.58.2 in vscode too but not activated currently. I have deactived all plugins in vscode.

I'm on windows 1809 (enterprise 17763.1935). No update possible.

Hard (or easy...) to explain how to reproduce this problem because, it appears when I start vscode directly with windows terminal (PowerShell Integrated Console v2021.8.0) or when I switch to this terminal from powershell terminal v7. The windows terminal doesn't start. Even if I reinitialize vscode, the problem remains. However, everything was working until this spring.

If you need others logs, i can provide it

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 10, 2021
@andyleejordan andyleejordan added Issue-Bug A bug to squash. and removed Resolution-Inactive Will close automatically. labels Aug 10, 2021
@andyleejordan
Copy link
Member

Oops, sorry, didn't mean to let the bot close this.

@andyleejordan
Copy link
Member

I really am not sure what's going on here, but the DryIoc package is a dependency of OmniSharp, so I'm trying to get it updated to its latest version (a bugfix release) in the hope that it may resolve your issue.

@andyleejordan andyleejordan added this to the Consider-vNext milestone Aug 10, 2021
@andyleejordan andyleejordan self-assigned this Aug 10, 2021
@ghost
Copy link

ghost commented Aug 19, 2021

This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

@ghost ghost closed this as completed Aug 19, 2021
@andyleejordan
Copy link
Member

Sorry, the bot got a little over-eager. We actually got DryIoc updated upstream in OmniSharp, and I was really hoping to land that in the latest preview, but it just barely missed the window. It will be in the next release though, so hopefully we can test soon and see if the updated package resolves it (the authors said "contains bugfixes!" so you know, 🤞).

@andyleejordan
Copy link
Member

@anankee26 PowerShell Preview 2021.8.2 will be out in just a few minutes, would you test and confirm this issue has been fully resolved? It comes with that update to OmniSharp v0.19.4 (and so DryIoc 4.8.1 per OmniSharp/csharp-language-server-protocol#610) Thanks!

@andyleejordan andyleejordan added the Needs: Fix Verification Please verify the fix for us! label Aug 23, 2021
@anankee26
Copy link
Author

Hello @andschwa ,

I disabled powershell 2021.8.0 and installed powershell preview 2021.8.2.

VS code in version

Version : 1.59.1 (user setup)
Commit : 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
Date : 2021-08-19T11:56:46.957Z
Electron : 13.1.7
Chrome : 91.0.4472.124
Node.js : 14.16.0
V8 : 9.1.269.36-electron.0
OS : Windows_NT x64 10.0.17763

Unfortunately, always an error when I start powershell windows 5.1. However, there are somes differences in the log with the previous:

=====> PowerShell Preview Integrated Console v2021.8.2 <=====

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 the "other party" for the  ticks without the completion. 
You may call `exception.TryGetDetails(container)` to get the details of the problematic service registration.
The error means that either the "other party" is the parallel thread which has started but is 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=NewNumberOfTicks`
   à DryIoc.ContainerException.WithDetails(Object details, 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 the "other party" for the  ticks without the completion. 
You may call `exception.TryGetDetails(container)` to get the details of the problematic service registration.
The error means that either the "other party" is the parallel thread which has started but is 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=NewNumberOfTicks`
   à DryIoc.ContainerException.WithDetails(Object details, 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 ==
2021-08-24 09:44:17.308 +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)
24/08/2021 09:44:05 [NORMAL] - Language server starting --
24/08/2021 09:44:05 [NORMAL] -     PowerShell executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
24/08/2021 09:44:05 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.8.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Preview Integrated Console v2021.8.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\logs\1629791045-e76fd145-f224-4939-bbf8-3b9ccc14fc6b1629791041761\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\sessions\PSES-VSCode-12492-922916' -FeatureFlags @() 
24/08/2021 09:44:05 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.8.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Preview Integrated Console v2021.8.2 <=====
' -LogLevel 'Normal' -LogPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\logs\1629791045-e76fd145-f224-4939-bbf8-3b9ccc14fc6b1629791041761\EditorServices.log' -SessionDetailsPath 'c:\Users\UUUU\.vscode\extensions\ms-vscode.powershell-preview-2021.8.2\sessions\PSES-VSCode-12492-922916' -FeatureFlags @() 
24/08/2021 09:44:05 [NORMAL] - powershell.exe started.
24/08/2021 09:44:05 [NORMAL] - Waiting for session file
24/08/2021 09:44:15 [NORMAL] - Session file found
24/08/2021 09:44:15 [NORMAL] - Registering terminal close callback
24/08/2021 09:44:15 [NORMAL] - Registering terminal PID log callback
24/08/2021 09:44:15 [NORMAL] - powershell.exe PID: 16252
24/08/2021 09:44:15 [NORMAL] - Language server started.
24/08/2021 09:44:15 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_1n5xc3hx.liu","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_bjdtgajk.pog"}
24/08/2021 09:44:15 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_1n5xc3hx.liu...
24/08/2021 09:44:15 [NORMAL] - Language service connected.

@andyleejordan
Copy link
Member

What is strange is how few people are affected by this bug. Some of my colleagues do not have this bug.

That is super strange and thanks for the heads up. Perhaps those logs will help. Reproducing this has been super difficult.

@andyleejordan
Copy link
Member

Was discussing this with @rjmholt and he has two ideas which are our best leads yet:

  1. The GAC has intercepted this load and given us back a bad assembly which has the type but not the method on the type (which seems really weird to Rob). This would require some version of System.Threading.Channels to not have this method, but as far as we can tell, it's always been available.
  2. The .NET Standard version of the library that we ship is trying to redirect by netstandard.dll to probably mscorlib.dll and is finding the type but not the method (which would imply a bug in .NET).

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Oct 5, 2021
@jutaylorREADI-zz
Copy link

jutaylorREADI-zz commented Nov 17, 2021

Out of nowhere I'm getting the same thing. Was literally working fine and I added a command to write some data to the terminal and I got this error:


Exception encountered starting EditorServices. Exception logged in D:\a\1\s\src\PowerShellEditorServices.Hosting\Commands\StartEditorServicesCommand.cs on line 246 in EndProcessing:
System.Management.Automation.CommandNotFoundException: The term 'Set-Variable' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.SetProfileVariableInCurrentRunspace(ProfilePathInfo profilePaths)
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.Initialize(ProfilePathInfo profilePaths, Runspace initialRunspace, Boolean ownsInitialRunspace, IHostOutput consoleHost)
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.Create(ILoggerFactory factory, ILanguageServerFacade languageServer, HostStartupInfo hostStartupInfo)
   at DryIoc.Registrator.ToFactoryDelegate[TService](Func`2 f, IResolverContext r)
   at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, Object paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Boolean useFec, Object& result)
   at DryIoc.Interpreter.TryInterpretAndUnwrapContainerException(IResolverContext r, Expression expr, Boolean useFec, Object& result)
   at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.Rules.<>c__DisplayClass74_1.<ConcreteTypeDynamicRegistrations>b__2(Request req)
   at DryIoc.RequestTools.MatchFactoryConditionAndMetadata(Request request, Factory factory)
   at DryIoc.Container.GetRuleSelectedServiceFactoryOrDefault(Request request, Type serviceType)
   at DryIoc.Container.DryIoc.IContainer.GetServiceFactoryOrDefault(Request request)
   at DryIoc.Container.DryIoc.IContainer.ResolveFactory(Request request)
   at DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved)
   at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved)
   at OmniSharp.Extensions.JsonRpc.JsonRpcHandlerCollectionExtensions.Populate(IJsonRpcHandlerCollection collection, IResolverContext resolverContext, IHandlersManager handlersManager)
   at DryIoc.Registrator.Initializer[TTarget,TService](TService service, IResolverContext resolver, Action`2 initialize)
   at DryIoc.Interpreter.TryInterpretAndUnwrapContainerException(IResolverContext r, Expression expr, Boolean useFec, Object& result)
   at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.Container.DryIoc.IContainer.GetDecoratorExpressionOrDefault(Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request)
   at DryIoc.Factory.GetExpressionOrDefault(Request request)
   at DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved)
   at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved)
   at DryIoc.Resolver.Resolve[TService](IResolver resolver, IfUnresolved ifUnresolved)
   at OmniSharp.Extensions.LanguageServer.Server.LanguageServer.<From>d__37.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Server.PsesLanguageServer.<StartAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Hosting.EditorServicesRunner.<CreateEditorServicesAndRunUntilShutdown>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Commands.StartEditorServicesCommand.EndProcessing()```

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 17, 2021
@StevenBucher98
Copy link
Contributor

@jutaylorREADI can you give more detail about the command you ran that caused this error? Can you also include your PowerShell version $PSVersiontable and VSCode extension version?

@StevenBucher98 StevenBucher98 removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 30, 2021
@andyleejordan
Copy link
Member

@jutaylorREADI I'm sorry, the error message is confusing due to the DryIoc library, it actually has nothing to do with this. In your error, the important part is this:

System.Management.Automation.CommandNotFoundException: The term 'Set-Variable' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Could you please file a new issue using our bug report template so we can triage it appropriately? Thank you!

@andyleejordan
Copy link
Member

andyleejordan commented Nov 30, 2021

@anankee26 Could you please try the latest Preview extension and let me know if your original issue still repros?

@anankee26
Copy link
Author

Hi @andschwa

Enclosed logs files.
unfortunaltely, always same problem with preview version

logs Powershell preview v2021.11.1.txt
logs Diagnotics Powershell preview v2021.11.1.txt
logs Powershell v2021.10.1 and .2.txt

thanks for the following !

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Dec 1, 2021
@itconsultingnc
Copy link

Hi,

have you found a solution ?
I have the same problem.

thank you

@andyleejordan
Copy link
Member

Nope, haven't found a solution yet. There's not been an easy way to repro this, and it seems like an issue between OmniSharp's LSP library and dependencies of PowerShell 5.1 😢

@itconsultingnc
Copy link

I have the same problem with PS 5.1 and 7....
And happend after a windows update the day 09 of february 2022.

@anankee26
Copy link
Author

Hi,

For me, it has been resolved by a new OS... I was working on windows 1809 et now on windows 22H2 with an installation from scratch. So Vscode, vscode-powershell, and windows powershell 5.1.19041.1320 (and core v7.2.1) work perfectly together for the moment.
The purpose of this new installation wasn't to resolve this problem particularly...
Thanks for your support !

@SydneyhSmith SydneyhSmith added Resolution-Inactive Will close automatically. and removed Needs: Maintainer Attention Maintainer attention needed! labels Feb 22, 2022
@SydneyhSmith
Copy link
Collaborator

This particular error is actually a number of issues that appear similar, please open a new issue will full information if you are still seeing this...thanks so much!

@itconsultingnc
Copy link

Hi,
I have done that :
#3827,
but for now, no solution was found.

@ghost
Copy link

ghost commented Mar 6, 2022

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@Zalson
Copy link

Zalson commented Mar 26, 2022

The solution I found was I had to reinstall 7.1, Windows PowerShell was no longer sufficient, even though it was selected in the VS Code settings.

@ghost
Copy link

ghost commented Mar 26, 2022

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@himynameissergey
Copy link

I installed the PowerShell Preview extension v2022.3.1 and this issue has been resolved

@ghost
Copy link

ghost commented Apr 7, 2022

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@andyleejordan andyleejordan unpinned this issue Apr 18, 2022
@nathan-chappell
Copy link

nathan-chappell commented Jun 29, 2022

This error started occuring for me after I upgraded my Powershell to Core 7.2.5.
I discovered two settings that made a difference in the error that got reported:

  1. PowerShell: PowerShell Default Version (It should be set to anything BUT Windows Powershell (x64))
  2. Powershell: Cwd (I needed to set it to ${workspaceFolder}

(1) Fixes the issues that were originally reported (the big stack trace error messages), while (2) fixes the next issue I had, which was the Powershell Language Server seemed to be hung (without error, I didn't wait 100 years to see if it would time out). Note that the recommended setting ${fileDirname} also caused issues.
Maybe there is something better to put there than ${workspaceFolder}, but that's pretty much the only vscode interpolated variable that I know by heart, and it does what I want, so I don't care.

EDIT:
Any chance you guys can get @msftbot to shut up?

@ghost
Copy link

ghost commented Jun 29, 2022

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

@andyleejordan
Copy link
Member

@efd7887 this is an official warning to please abide by our Code of Conduct, keep discussion civl, and avoid personal insults.

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-Inactive Will close automatically.
Projects
None yet
Development

No branches or pull requests

12 participants