Skip to content

Language service crashes on dot-sourced path in script #224

Closed
@wellsluo

Description

@wellsluo
  • VSCode Version: 1.3.1
  • OS Version: Windows 10.1511
  • PowerShell Extension version: 0.6.1

Reproduced on at least 2 Windows 10 machines.

Symptom

  1. "Find All References" show empty window or "No result" window. So as "Go to definition".
  2. Auto complete doesn't work to show related PowerShell cmdlet.
  3. Ctrl+ mouse hover on function name, doesn't show underline and can't click to jump function declaration.

Steps to Reproduce:

  1. Open VSCode
  2. Open PS1 script.

EditorServices.log file shows unhandled exception:

7/13/2016 14:51:17 [NORMAL] - Method "Main" at line 145 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\Program.cs

PowerShell Editor Services Host v0.6.1.356 starting (pid 13060)...

  Host application details:

    Name: Visual Studio Code Host
    ProfileId: Microsoft.VSCode
    Version: 0.6.1

7/13/2016 14:51:17 [NORMAL] - Method "Initialize" at line 186 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

PowerShell runtime version: 5.0.10586.122

7/13/2016 14:51:18 [NORMAL] - Method "Main" at line 165 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\Program.cs

PowerShell Editor Services Host started!

7/13/2016 14:51:22 [ERROR] - Method "CurrentDomain_UnhandledException" at line 178 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\Program.cs

FATAL UNHANDLED EXCEPTION:

System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.IsPathRooted(String path)
   at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyFindReferences(ScriptFile scriptFile, Dictionary`2 referencedScriptFiles)
   at Microsoft.PowerShell.EditorServices.Workspace.ExpandScriptReferences(ScriptFile scriptFile)
   at Microsoft.PowerShell.EditorServices.LanguageService.<GetDefinitionOfSymbol>d__16.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.<HandleDefinitionRequest>d__20.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__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.Protocol.MessageProtocol.MessageDispatcher.<ListenForMessages>d__31.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()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   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 Microsoft.PowerShell.EditorServices.Host.Program.Main(String[] args)
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.IsPathRooted(String path)
   at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyFindReferences(ScriptFile scriptFile, Dictionary`2 referencedScriptFiles)
   at Microsoft.PowerShell.EditorServices.Workspace.ExpandScriptReferences(ScriptFile scriptFile)
   at Microsoft.PowerShell.EditorServices.LanguageService.<GetDefinitionOfSymbol>d__16.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.<HandleDefinitionRequest>d__20.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__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.Protocol.MessageProtocol.MessageDispatcher.<ListenForMessages>d__31.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()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.IsPathRooted(String path)
   at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyFindReferences(ScriptFile scriptFile, Dictionary`2 referencedScriptFiles)
   at Microsoft.PowerShell.EditorServices.Workspace.ExpandScriptReferences(ScriptFile scriptFile)
   at Microsoft.PowerShell.EditorServices.LanguageService.<GetDefinitionOfSymbol>d__16.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.<HandleDefinitionRequest>d__20.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__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.Protocol.MessageProtocol.MessageDispatcher.<ListenForMessages>d__31.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()<---
<---

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions