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

Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition out of range #567

Closed
codykonior opened this issue Nov 2, 2017 · 3 comments

Comments

@codykonior
Copy link

codykonior commented Nov 2, 2017

Hi,

I'm using VS Code 1.17.2, VS Code PowerShell 1.5.0, which bundles 1.5.0 of this module. When I trigger debugging, my debug sessions often terminate unexpectedly along with my PowerShell terminals. This is on Windows Server 2012 R2.

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

Here's the relevant part of the logs (there's some lead up but it's at the end):

2/11/2017 3:03:14 PM [VERBOSE] - Method "ExecuteCommand" at line 491 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Attempting to execute command(s):
    
        Microsoft.PowerShell.Utility\Set-PSBreakpoint
    

2/11/2017 3:03:14 PM [VERBOSE] - Method "OnSessionStateChanged" at line 1138 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Ready
        New state: Running
        Result: NotFinished

2/11/2017 3:03:14 PM [VERBOSE] - Method "OnSessionStateChanged" at line 1138 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Running
        New state: Ready
        Result: Completed

2/11/2017 3:03:14 PM [VERBOSE] - Method "ExecuteCommand" at line 551 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Execution completed successfully.

2/11/2017 3:03:14 PM [VERBOSE] - Method "WriteMessage" at line 61 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageWriter.cs

    Writing Response 'setBreakpoints' with id 9

2/11/2017 3:03:14 PM [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 is outside of column range for line 174.
       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 is outside of column range for line 174.
       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()<---
    

2/11/2017 3:03:14 PM [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.

That ValidatePosition part is causing everything to crash - I've got hundreds of crash dumps ending in it. I'm not sure which part of the 3 components is responsible but it seems to be this - hence the issue.

Hope that helps.

@rkeithhill
Copy link
Contributor

Thanks for reporting this.

@rkeithhill
Copy link
Contributor

Probably a bit late know but do you recall which file you were editing and what was on line 174?

    Parameter name: Position is outside of column range for line 174.

@rkeithhill
Copy link
Contributor

I think this will be fixed in the upcoming 1.5.1 release. If you encounter the same issue again, please re-open this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants