Skip to content

EditorServices Crash - ERRORS caught while waiting for EditorServicesHost to complete execution #1492

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
PrzemyslawKlys opened this issue Aug 20, 2018 · 13 comments · Fixed by PowerShell/PowerShellEditorServices#730
Assignees
Labels
Issue-Bug A bug to squash.

Comments

@PrzemyslawKlys
Copy link
Contributor

System Details

  • Operating system name and version:
  • VS Code version: 1.26.1
  • PowerShell extension version: 1.8.3
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.17738.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17738.1000
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation> $pseditor.EditorServicesVersion
PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation> code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
openssl config failed: error:02001003:system library:fopen:No such process
PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17738.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17738.1000
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with... Editor Services crashing.

#-- Waiting for EditorServicesHost to complete execution ---------------------
VERBOSE: ERRORS caught while waiting for EditorServicesHost to complete execution
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.

Specified argument was out of the range of valid values.
Parameter name: Position 284:1 is outside of the line range of 1 to 283.
   at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
   at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
   at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
   at System.Threading.Tasks.Task.Execute()
PS>$global:?
True
**********************
Windows PowerShell transcript end
End time: 20180820172833
**********************

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

1534771635-da9828e6-52a6-47a2-a062-a301bcd324121534770956637.zip

@rjmholt
Copy link
Contributor

rjmholt commented Aug 20, 2018

@PrzemyslawKlys do you have a small reproducible scenario at all? What were doing when the crash happened?

@rjmholt rjmholt added Issue-Bug A bug to squash. Area-General labels Aug 20, 2018
@PrzemyslawKlys
Copy link
Contributor Author

Unfortunately it doesn't happen a lot. It happend 3 times so far in 2 days.

I believe in last case it just happend. I was typing something in VSCode, maybe doing CTRL C+V and it simply crashed.

But it as well cane be related to those 2 things:

  • i frequently use CTRL + S and I have format on Save - I don't think I did this this time thou
  • i use onedrive to store my files (as additional safe to github commits) so things may trigger weird results

@rjmholt
Copy link
Contributor

rjmholt commented Aug 20, 2018

Understood.

I'm pretty certain it's a race condition.

I'll need to look into it as part of broader work on the extension (getting threading right generally), so the fix is unlikely to be simple or immediate.

@PrzemyslawKlys
Copy link
Contributor Author

Happend again:


2018-08-20 21:35:34.378 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs: In method 'ReadMessage', line 123:
    Received Event 'textDocument/didChange'

2018-08-20 21:35:34.384 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices\Workspace\Workspace.cs: In method 'ResolveFilePath', line 378:
    Resolved path: c:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWriteWord\Publish\Manage-PSWriteWord.ps1

2018-08-20 21:35:34.388 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: In method 'OnListenTaskCompleted', line 391:
    ProtocolEndpoint message loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 15:1 is outside of the line range of 1 to 14.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 15:1 is outside of the line range of 1 to 14.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()<---
    

2018-08-20 21:35:34.388 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'ProtocolEndpoint_UnhandledException', line 435:
    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.

Was just editing some code. Stopped, was looking at something else and noticed it crashed.

@PrzemyslawKlys
Copy link
Contributor Author

And another one:

018-08-20 22:15:53.536 [DIAGNOSTIC] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs: In method 'ReadMessage', line 114:
    READ MESSAGE:
    
    {
      "jsonrpc": "2.0",
      "method": "textDocument/didChange",
      "params": {
        "textDocument": {
          "uri": "file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWriteWord/Publish/Manage-PSWriteWord.ps1",
          "version": 4
        },
        "contentChanges": [
          {
            "range": {
              "start": {
                "line": 14,
                "character": 0
              },
              "end": {
                "line": 16,
                "character": 0
              }
            },
            "rangeLength": 4,
            "text": ""
          }
        ]
      }
    }

2018-08-20 22:15:53.536 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs: In method 'ReadMessage', line 123:
    Received Event 'textDocument/didChange'

2018-08-20 22:15:53.544 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices\Workspace\Workspace.cs: In method 'ResolveFilePath', line 378:
    Resolved path: c:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWriteWord\Publish\Manage-PSWriteWord.ps1

2018-08-20 22:15:53.550 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: In method 'OnListenTaskCompleted', line 391:
    ProtocolEndpoint message loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 17:1 is outside of the line range of 1 to 16.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 17:1 is outside of the line range of 1 to 16.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()<---
    

2018-08-20 22:15:53.551 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'ProtocolEndpoint_UnhandledException', line 435:
    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.

Let me know if you want me to keep on adding as i encounter those or it's enough for now (maybe you need full log as well). I guess without reproducible case it's not gonna be easy/nessecary. One more thing that I do common is having 3+ VS Code windows with 3 different projects open at all times.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 22, 2018

This information seems like enough to go on for now -- it looks like the file offset in VSCode is not synchronised with the actual file.

It's the kind of thing that may be difficult to implement correctly, but we should still catch the error and just move on.

@csandfeld
Copy link

I am experiencing what I believe to be the same issue, several times a day.
I think the problem first occured after the powershell extension was updated to version 1.8.3 (however that may be coincidental).

Logs and environment info attached below

Attached Logs

EditorServices.log

2018-08-23 16:10:14.519 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'StartLogging', line 160:
    PowerShell Editor Services Host v1.8.3.0 starting (pid 28868)...
    
      Host application details:
    
        Name:      Visual Studio Code Host
        ProfileId: Microsoft.VSCode
        Version:   1.8.3
        Arch:      64-bit
    
      Operating system details:
    
        Version: Microsoft Windows NT 10.0.17134.0
        Arch:    64-bit

2018-08-23 16:10:14.552 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'StartLanguageService', line 194:
    Language service started, type = NamedPipe, endpoint = PSES_25316eba-2bfa-496e-b0f8-b9a7efd2fd1c

2018-08-23 16:10:14.560 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'StartDebugService', line 266:
    Debug service started, type = NamedPipe, endpoint = PSES_1033ab05-bcb3-4002-afd2-42ae3bdc224b

2018-08-23 16:10:15.139 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs: In method 'Initialize', line 220:
    PowerShell runtime version: 5.1.17134.228, edition: Desktop

2018-08-23 16:10:16.202 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.VSCode\ComponentRegistration.cs: In method 'Register', line 36:
    PowerShell Editor Services VS Code module loaded.

2018-08-23 16:10:27.621 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:27.621 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:36.822 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:36.822 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:41.766 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:41.766 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:47.118 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:47.118 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:50.858 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:50.858 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:53.354 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:53.354 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:10:58.637 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\Server\DebugAdapter.cs: In method 'Stop', line 167:
    Debug adapter is shutting down...

2018-08-23 16:10:58.637 [NORMAL] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'OnDebugServiceClientConnect', line 312:
    Previous debug session ended, restarting debug service listener...

2018-08-23 16:11:04.457 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: In method 'OnListenTaskCompleted', line 391:
    ProtocolEndpoint message loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 59:1 is outside of the line range of 1 to 58.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 59:1 is outside of the line range of 1 to 58.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass6_0`2.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>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.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.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.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()<---
    

2018-08-23 16:11:04.458 [ERROR] C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: In method 'ProtocolEndpoint_UnhandledException', line 435:
    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.

vscode-powershell.log

8/23/2018 4:10:13 PM [NORMAL] - Language server starting --
8/23/2018 4:10:13 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
8/23/2018 4:10:13 PM [NORMAL] -     args: C:\Users\chsa\.vscode\extensions\ms-vscode.powershell-1.8.3\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.8.3'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\chsa\.vscode\extensions\ms-vscode.powershell-1.8.3\modules'-EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\chsa\.vscode\extensions\ms-vscode.powershell-1.8.3\logs\1535033413-5f36e452-ea75-4bf0-bd08-482fc038060c1534926153176\EditorServices.log' -SessionDetailsPath 'C:\Users\chsa\.vscode\extensions\ms-vscode.powershell-1.8.3\sessions\PSES-VSCode-7796-818062' -FeatureFlags @()
8/23/2018 4:10:13 PM [NORMAL] - powershell.exe started, pid: 28868
8/23/2018 4:10:15 PM [NORMAL] - Language server started.
8/23/2018 4:10:15 PM [NORMAL] - Language service connected.
8/23/2018 4:10:15 PM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_1033ab05-bcb3-4002-afd2-42ae3bdc224b","languageServicePipeName":"\\\\.\\pipe\\PSES_25316eba-2bfa-496e-b0f8-b9a7efd2fd1c"}
8/23/2018 4:10:15 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_25316eba-2bfa-496e-b0f8-b9a7efd2fd1c...
8/23/2018 4:11:07 PM [NORMAL] - powershell.exe terminated or terminal UI was closed

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17134
VSCode 1.26.1
PowerShell Extension Version 1.8.3

PowerShell Information

Name Value
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17134.228
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
code-settings-sync Shan 3.0.0
csharp ms-vscode 1.15.2
gc-excelviewer GrapeCity 2.1.26
gitlens eamodio 8.5.6
markdown-preview-github-styles bierner 0.1.2
Material-theme zhuangtongfa 2.15.4
nord-visual-studio-code arcticicestudio 0.6.0
PowerShell ms-vscode 1.8.3
rainbow-csv mechatroner 0.4.2
team ms-vsts 1.136.0
theme-sapphire Tyriar 0.7.0
vscode-icontheme-nomo-dark be5invis 1.3.6
vscode-markdownlint DavidAnson 0.20.0
vscode-theme-onedark akamud 2.1.0

@csandfeld
Copy link

Let me know if you want me to try reproducing with verbose logging enabled.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 23, 2018

Hi @csandfeld, I think the logging has identified where in the code the issue is, but won't help us identify why.

Can you describe anything about how you were modifying the script when the extension crashed?

@csandfeld
Copy link

Hi @rjmholt

I ran into this issue several times today, while testing some enums, classes, functions, and C# code (with Add-Type). I loaded a file holding the enums and classes, and a number of files each holding a function, into the active session using F5 (so running the debugger, but without doing any actual debugging). Then while typing a variable name ($whatever) in some test code, it would crash. Did that several times in a row.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 23, 2018

The variable name was at the end of the file right? Was the file a new untitled file? Or a modification of one changed on the filesystem?

@rjmholt
Copy link
Contributor

rjmholt commented Aug 23, 2018

Ok, I think I've got this one fixed

@csandfeld
Copy link

@rjmholt: Yes, the edit was at or towards the end of the file (there may or may not have been some line breaks after), and it was a modification of an existing file.

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
3 participants