Skip to content

Code action requests from other extensions crash the language server #408

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
itzik-h opened this issue Dec 20, 2016 · 5 comments
Closed
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@itzik-h
Copy link

itzik-h commented Dec 20, 2016

Please fill in these details so that we can help you!

System Details

  • Operating system name and version: win 7x64
  • VS Code version: 1.8.0, 1.8.1
  • PowerShell extension version: 0.8.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
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

PowerShell extension is terminating continuously (after each restart vie the new option to restart).
I could not find any specific action that triggers this.

Attached Logs

1482223271-ffd84f24-843f-4fa6-9ca4-8121f1d74e961482222573215.zip

@daviwil
Copy link
Contributor

daviwil commented Dec 20, 2016

Hey @itzik-h, I see what's going on in the logs but I am a little surprised at what is happening. Could you turn on verbose logging, reproduce the issue, and send me your logs again? It'd help me understand what VS Code is sending which is causing the problem. At any rate, we'll definitely get this fixed for tomorrow's patch release!

@daviwil daviwil added the Issue-Bug A bug to squash. label Dec 20, 2016
@daviwil daviwil added this to the 0.8.1 milestone Dec 20, 2016
@itzik-h
Copy link
Author

itzik-h commented Dec 20, 2016

The log contains lots of sensitive information.
Using the Verbose logs I think I have narrowed it down to some interop with a spellchecker plugin streetsidesoftware.code-spell-checker.
log snippet:

20/12/2016 17:51:04 [VERBOSE] - Method "ReadMessage" at line 111 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    READ MESSAGE:
    
    {
      "jsonrpc": "2.0",
      "id": 16,
      "method": "textDocument/codeAction",
      "params": {
        "textDocument": {
          "uri": "file:///removed_path.ps1"
        },
        "range": {
          "start": {
            "line": 6,
            "character": 18
          },
          "end": {
            "line": 6,
            "character": 32
          }
        },
        "context": {
          "diagnostics": [
            {
              "range": {
                "start": {
                  "line": 6,
                  "character": 18
                },
                "end": {
                  "line": 6,
                  "character": 32
                }
              },
              "message": "Unknown word: \"sdfgsdfgsdfg\"",
              "severity": 3,
              "source": "cSpell Checker"
            }
          ]
        }
      }
    }

20/12/2016 17:51:04 [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.ArgumentNullException: Value cannot be null.
    Parameter name: key
       at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleCodeActionRequest>d__38.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__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.<ListenForMessages>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.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
    Parameter name: key
       at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleCodeActionRequest>d__38.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__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.<ListenForMessages>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.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
       at System.Threading.Tasks.Task.Execute()<---

When ever there is a typo in the code - PowerShellEditorServices crushes.
I must have lots of typos :) as disabling this plugin stooped the problem.

@daviwil
Copy link
Contributor

daviwil commented Dec 20, 2016

Thanks for sending that, it's exactly what I needed to see. Weird that they're sending us requests for the markers of a different extension! Looks like I'll need to ignore anything code action request with a source that I don't recognize.

@rkeithhill
Copy link
Contributor

I wonder if that is a VSCode bug?

@daviwil
Copy link
Contributor

daviwil commented Dec 20, 2016

Yeah, it's a possibility. I might file an issue over there to see what they say about it.

@daviwil daviwil changed the title Method "OnListenTaskCompleted" MessageDispatcher loop terminated due to unhandled exception Code action requests from other extensions crash the language server Dec 20, 2016
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

3 participants