Closed PrzemyslawKlys closed 6 years ago
@PrzemyslawKlys do you have a small reproducible scenario at all? What were doing when the crash happened?
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:
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.
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.
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.
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.
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
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.
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
Name | Version |
---|---|
Operating System | Windows_NT x64 10.0.17134 |
VSCode | 1.26.1 |
PowerShell Extension Version | 1.8.3 |
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 |
Let me know if you want me to try reproducing with verbose logging enabled.
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?
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.
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?
Ok, I think I've got this one fixed
@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.
System Details
$PSVersionTable
:Issue Description
I am experiencing a problem with... Editor Services crashing.
Attached Logs
Follow the instructions in the README about capturing and sending logs.
1534771635-da9828e6-52a6-47a2-a062-a301bcd324121534770956637.zip