PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Visual Studio Integration - Error in PSES
I'm seeing an error in PSES when integrating with VS. I'm not sure if it's a problem with my integration or with PSES. PSScriptAnaylzer is showing suggestions but IntelliSense doesn't work.
PSES 3.3.1 VS 17.1.5
Error in PSES log.
2022-04-24 13:05:59.212 -06:00 [FTL] Failed to handle request textDocument/hover 8
System.InvalidOperationException: Stack empty.
at System.Collections.Generic.Stack`1.ThrowForEmptyStack()
at System.Collections.Generic.Stack`1.Peek()
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentFrame() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 157
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 141
at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace.IRunspaceContext.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 155
at Microsoft.PowerShell.EditorServices.Services.SymbolsService.FindSymbolDetailsAtLocationAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\SymbolsService.cs:line 309
at Microsoft.PowerShell.EditorServices.Handlers.PsesHoverHandler.Handle(HoverParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\HoverHandler.cs:line 49
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()
Activity Log VS
<entry>
<record>2637</record>
<time>2022/04/24 19:05:57.224</time>
<type>Information</type>
<source>VisualStudio</source>
<description>End package load [FileSystem Package]</description>
<guid>{AC2BF811-80A4-4FA9-A405-21EC39316782}</guid>
</entry>
<entry>
<record>2638</record>
<time>2022/04/24 19:05:59.354</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.AggregateException: One or more errors occurred. ---> StreamJsonRpc.RemoteInvocationException: Internal Error - System.InvalidOperationException: Stack empty.
 at System.Collections.Generic.Stack`1.ThrowForEmptyStack()
 at System.Collections.Generic.Stack`1.Peek()
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentFrame() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 157
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 141
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace.IRunspaceContext.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 155
 at Microsoft.PowerShell.EditorServices.Services.SymbolsService.FindSymbolDetailsAtLocationAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\SymbolsService.cs:line 309
 at Microsoft.PowerShell.EditorServices.Handlers.PsesHoverHandler.Handle(HoverParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\HoverHandler.cs:line 49
 at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
 at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
 at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()
 at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__143`1.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.VisualStudio.LanguageServer.Client.JsonRpcExtensionMethods.<SendMethodRequestAsync>d__0`2.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.VisualStudio.LanguageServer.Client.MefClient.<SendRequestAsync>d__21`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.EnqueuedMessage`2.<GetResultsAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.EnqueuedMessage`2.<GetResultsAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.LanguageServiceClient.<<EnqueueStreamingRequestAsync>g__RepackResultsAsync|44_0>d`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.LanguageServiceClient.<<EnqueueStreamingRequestAsync>g__RepackResultsAsync|44_0>d`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<MoveNextWrappedAsync>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<SelectManyAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.HoverSource.<RequestHoverAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.HoverSource.<RequestHoverAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<FirstOrDefaultAsync>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<FirstOrDefaultAsync>d__0`1.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.VisualStudio.LanguageServer.Client.HoverSource.<GetQuickInfoItemAsync>d__7.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.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
 --- End of inner exception stack trace ---
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<UpdateAsync>d__32.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.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoPresentationSession.<UpdateAsync>d__5.MoveNext()
---> (Inner Exception #0) StreamJsonRpc.RemoteInvocationException: Internal Error - System.InvalidOperationException: Stack empty.
 at System.Collections.Generic.Stack`1.ThrowForEmptyStack()
 at System.Collections.Generic.Stack`1.Peek()
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentFrame() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 157
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 141
 at Microsoft.PowerShell.EditorServices.Services.PowerShell.Host.PsesInternalHost.Microsoft.PowerShell.EditorServices.Services.PowerShell.Runspace.IRunspaceContext.get_CurrentRunspace() in D:\a\_work\1\s\src\PowerShellEditorServices\Services\PowerShell\Host\PsesInternalHost.cs:line 155
 at Microsoft.PowerShell.EditorServices.Services.SymbolsService.FindSymbolDetailsAtLocationAsync(ScriptFile scriptFile, Int32 lineNumber, Int32 columnNumber) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\Symbols\SymbolsService.cs:line 309
 at Microsoft.PowerShell.EditorServices.Handlers.PsesHoverHandler.Handle(HoverParams request, CancellationToken cancellationToken) in D:\a\_work\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\HoverHandler.cs:line 49
 at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
 at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
 at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
 at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()
 at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__143`1.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.VisualStudio.LanguageServer.Client.JsonRpcExtensionMethods.<SendMethodRequestAsync>d__0`2.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.VisualStudio.LanguageServer.Client.MefClient.<SendRequestAsync>d__21`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.EnqueuedMessage`2.<GetResultsAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.EnqueuedMessage`2.<GetResultsAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.LanguageServiceClient.<<EnqueueStreamingRequestAsync>g__RepackResultsAsync|44_0>d`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.LanguageServiceClient.<<EnqueueStreamingRequestAsync>g__RepackResultsAsync|44_0>d`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<MoveNextWrappedAsync>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<SelectManyAsync>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.HoverSource.<RequestHoverAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.HoverSource.<RequestHoverAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<FirstOrDefaultAsync>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.LanguageServer.Client.AsyncEnumerableExtensions.<FirstOrDefaultAsync>d__0`1.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.VisualStudio.LanguageServer.Client.HoverSource.<GetQuickInfoItemAsync>d__7.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.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)<---
</description>
</entry>
hmm thanks for opening this @adamdriscoll we will take a deeper look at this integration after we finish a few other high priority work items