You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Launcher" file. Used to set some vars and execute the script I'm currently working on. I created a debug configuration that launches that file. It has 29 lines
The script file. It has 100+ lines.
The issue itself. Sometimes when I edit the second file and then switch to the first one and start typing, the PowerShell Intergrated terminal crashes right before the IntelliSence autocomplete happens. Examining verbose log discovered the ArgumentOutOfRangeException (see below). Looks like that editor position (109:2) passed to the Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition method is taken from the previous file. Since line number is bigger than actual line count in the currently open file, the Exception is thrown.
Empirically, this looks like that for some reason editor is not able to fully switch between editors in a timely fashion or the editor position is not updated on file change, but this is just a guess.
Sometimes it happens very often forcing me to restart the terminal loosing all the prepared environment which is very frustrating on long-running scripts that use cached values during development.
It looks like issue described in #918, which is not fixed yet.
Attached Logs
Nothing uncommon in the logs, except the last exception:
07.02.2018 8:27:20 [ERROR] - Method "OnListenTaskCompleted" at line 391 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs
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 109:2 is outside of the line range of 1 to 29.
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
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 109:2 is outside of the line range of 1 to 29.
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<---
07.02.2018 8:27:20 [ERROR] - Method "ProtocolEndpoint_UnhandledException" at line 418 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs
PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.
The text was updated successfully, but these errors were encountered:
antikhonov
changed the title
Integrated Terminal Crashes Due To Incorrect Editor Position
Integrated Terminal crashes due to incorrect editor position
Feb 7, 2018
After some tests, I was able to find the most probable reason for such behavior: the MS anti-Meltdown patch. If it is turned off, the problem vanishes. My CPU model is Intel Core2 Quad CPU Q9500 @ 2.83GHz. Turns out that applying the MS patch for Meltdown breaks the VS code or the PowerShell extension somehow. If this is true, will it be fixed somehow in the next version?
System Details
Operating system name and version: Windows 10.0.14393
Issue Description
Environment. I have tho editors open
The issue itself. Sometimes when I edit the second file and then switch to the first one and start typing, the PowerShell Intergrated terminal crashes right before the IntelliSence autocomplete happens. Examining verbose log discovered the ArgumentOutOfRangeException (see below). Looks like that editor position (109:2) passed to the Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition method is taken from the previous file. Since line number is bigger than actual line count in the currently open file, the Exception is thrown.
Empirically, this looks like that for some reason editor is not able to fully switch between editors in a timely fashion or the editor position is not updated on file change, but this is just a guess.
Sometimes it happens very often forcing me to restart the terminal loosing all the prepared environment which is very frustrating on long-running scripts that use cached values during development.
It looks like issue described in #918, which is not fixed yet.
Attached Logs
Nothing uncommon in the logs, except the last exception:
07.02.2018 8:27:20 [ERROR] - Method "OnListenTaskCompleted" at line 391 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs
07.02.2018 8:27:20 [ERROR] - Method "ProtocolEndpoint_UnhandledException" at line 418 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs
The text was updated successfully, but these errors were encountered: