Skip to content

Fail Starting Powershell - VS Code #3827

Closed
@itconsultingnc

Description

@itconsultingnc

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

Hi,
When opening Visual Studio Code, powershell try to start, but failed.
With 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.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.FactoryMethod.<>c__DisplayClass10_0.<Constructor>b__0(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)<---

Try with version of powershell extension :
PowerShell Integrated Console v2021.12.0
and
PowerShell Preview Integrated Console v2022.2.0

Same problem.
A few day ago, everything was working well, I don't know if some update occur, but right now it's not working anymore.

Windows 10 Entreprise x64 10.0.19044

PowerShell Version

Unable to entere this commande in Visual Code due to issue.
But i am using Powershell 7 and 5.1, same problem.

Visual Studio Code Version

VS code version : 1.64.2
64 bit

Extension Version

Steps to Reproduce

open Visual studio code
try to start Powershell
powershell

Visuals

No response

Logs

EditorServices.log :


2022-02-14 10:27:43.356 +11: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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions