Skip to content
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

Invoking "Go to Definition" in an untitled script causes a host crash #645

Closed
Rick-2CA opened this issue Apr 4, 2017 · 1 comment
Closed
Milestone

Comments

@Rick-2CA
Copy link

Rick-2CA commented Apr 4, 2017

System Details

  • Operating system name and version:
    Win 8.1 Pro
  • VS Code version:
    1.10.2
    8076a19fdcab7e1fc1707952d652f0bb6c6db331
  • PowerShell extension version:
    christian-kohler.path-intellisense@1.2.0
    emilast.LogFileHighlighter@1.1.1
    ivangabriele.vscode-tfs@0.6.0
    ms-vscode.PowerShell@0.11.0
    ms-vsts.team@1.115.0
  • Output from $PSVersionTable:
    PSVersion 5.0.10586.117
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.10586.117
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

Issue Description

The application reports that the PowerShell console has crashed and prompts me with a Yes | No | Close for restarting it. The terminal is still functional after hitting close. I'm not using the terminal before the crash is reported.

Attached Logs

Logs being sent to David.

@daviwil daviwil changed the title Console Crash Invoking "Go to Definition" in an untitled script causes a host crash Apr 4, 2017
@daviwil
Copy link
Contributor

daviwil commented Apr 4, 2017

Looks like we're not handling untitled file paths in code navigation actions. Here is the relevant part of the logs:


4/4/2017 10:02:49 AM [VERBOSE] - Method "ReadMessage" at line 111 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    READ MESSAGE:
    
    {
      "jsonrpc": "2.0",
      "id": 439,
      "method": "textDocument/definition",
      "params": {
        "uri": "untitled:Untitled-1",
        "position": {
          "line": 0,
          "character": 5
        }
      }
    }

4/4/2017 10:02:49 AM [VERBOSE] - Method "ResolveFilePath" at line 294 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Workspace\Workspace.cs

    Resolved path: untitled:Untitled-1

4/4/2017 10:02:49 AM [ERROR] - Method "OnListenTaskCompleted" at line 337 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageDispatcher.cs

    MessageDispatcher loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
       at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleDefinitionRequest>d__34.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()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.UriFormatException: Invalid URI: The hostname could not be parsed.
       at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleDefinitionRequest>d__34.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 modified the milestones: Next Patch Update, Next Feature Update, April 2017, 0.12.2 Apr 4, 2017
daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Apr 7, 2017
This change fixes a host crash which occurs when the user tries to
perform a symbol operation (like Go to Definition or Find References) in
an untitled script file.  The fix is to not try and convert an untitled
file's path to a Uri.

Resolves PowerShell/vscode-powershell#645
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants