Skip to content

IntelliSense running in the debugger can crash the Editor Services host #427

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
daviwil opened this issue Apr 6, 2017 · 0 comments
Closed
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@daviwil
Copy link
Contributor

daviwil commented Apr 6, 2017

Looks like I need to handle a possible ErrorRecord result from running TabExpansion2:

Caught error while waiting for EditorServicesHost to complete:
One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.WaitForExit()
   at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.

Unable to cast object of type 'System.Management.Automation.ErrorRecord' to type 'System.Management.Automation.CommandCompletion'.
   at System.Linq.Enumerable.<CastIterator>d__94`1.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Microsoft.PowerShell.EditorServices.AstOperations.<GetCompletions>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.LanguageService.<GetCompletionsInFile>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleCompletionRequest>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<ListenForMessages>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
   at System.Threading.Tasks.Task.Execute()
@daviwil daviwil added the Issue-Bug A bug to squash. label Apr 6, 2017
@daviwil daviwil added this to the April 2017 milestone Apr 6, 2017
daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Apr 7, 2017
This change fixes an issue where calling TabExpansion2 while debugging
will sometimes cause a crash due to it returning an ErrorRecord instead
of a CommandCompletion.  The fix is to expect the possibility of the
ErrorRecord and log it when it occurs.

Resolves PowerShell#427.
@daviwil daviwil modified the milestones: 0.12.1, April 2017 Apr 7, 2017
daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Apr 7, 2017
This change fixes an issue where calling TabExpansion2 while debugging
will sometimes cause a crash due to it returning an ErrorRecord instead
of a CommandCompletion.  The fix is to expect the possibility of the
ErrorRecord and log it when it occurs.

Resolves PowerShell#427.
TylerLeonhardt pushed a commit to TylerLeonhardt/PowerShellEditorServices that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

1 participant