Skip to content

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

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 Sep 1, 2018 · 9 comments
Labels
Issue-Bug A bug to squash.

Comments

@PrzemyslawKlys
Copy link
Contributor

System Details

  • Operating system name and version:
  • VS Code version:
  • PowerShell extension version:
  • Output from $PSVersionTable:
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable

Issue Description

I am experiencing a problem with...

Still exists in 1.84 - related to #1492

2018-09-01 19:02:40.729 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs: In method 'ReadMessage', line 123:
    Received Event 'textDocument/didChange'

2018-09-01 19:02:40.729 [VERBOSE] C:\PowerShellEditorServices\src\PowerShellEditorServices\Workspace\Workspace.cs: In method 'ResolveFilePath', line 378:
    Resolved path: c:\Users\pklys\OneDrive - Evotec\Support\GitHub\PlatyPS\test\Pester\PlatyPs.Tests.ps1

2018-09-01 19:02:40.733 [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 880:44 is outside of the column range of 1 to 1.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column, Boolean isInsertion)
       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 880:44 is outside of the column range of 1 to 1.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column, Boolean isInsertion)
       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-09-01 19:02:40.733 [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.


Unless it's different error.. I was editing code and removed \ or '

        $UpdatedFiles | Where { $_ -like '*\platyPS.md' } | Should -Be $Null
        $UpdatedFiles | Where { $_ -like '*\Test-RefreshModuleFunctionality.md' } | Should -Not -Be $Null

which made the text below that highlight everything and it crashed.

Attached Logs

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

@rjmholt
Copy link
Contributor

rjmholt commented Sep 2, 2018

This crash is more mysterious. The relevant part of the error seems to be:

Parameter name: Position 880:44 is outside of the column range of 1 to 1.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 3, 2018

@PrzemyslawKlys are you still experiencing this issue in 1.9.0?

@PrzemyslawKlys
Copy link
Contributor Author

Haven't had crashes on 1.9.0 yet. Any crashes to be honest. I do hit "hidden" blockage of running scripts but that's a separate issue, most likely because I am trigger happy.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 3, 2018

Hmmm, if you can find a good repro of that issue with logs, definitely open an issue. Trigger happiness shouldn't inhibit PowerShell usage.

I'm hoping the 1.9.0 release improves stability/reliability in general (since it's what I was working toward). Hopefully our next investment area can be in fixing up the debugging experience.

@PrzemyslawKlys
Copy link
Contributor Author

That's the thing. When that happens there is nothing in logs. And even restarting powershell session doesn't fix it. This is the issue #1537 - there's a gif showing it's behaviour. And it happens randomly. Sometimes I can go for hours without issue and sometimes I open VSCode, PS code and it's stuck, restarting VS Code fixes it for few minutes and again.. I have no clue how to track it and it's not reproducible on demand. In that GIF it displays that debug session is in progress but I've seen instances where that is not displayed at all. Just F5 stops working.

@PrzemyslawKlys
Copy link
Contributor Author

And another thing is .. maybe we have different view on this but I don't use "debugging".

image

I use F5 (without debugging). But maybe you're just calling it debugging because of stuff it does and you're not referring to F5 vs CTRL+F5 (I've reversed them thinking it would trigger less problems).

@PrzemyslawKlys
Copy link
Contributor Author

1540204749-cadee31e-1c25-44b7-af0b-5104ee2efe861540194055613.zip

On insiders version still the same problem. Copied

$Script:UserProperties = 'Name', 'UserPrincipalName', 'SamAccountName', 'Enabled', 'PasswordLastSet', `
'PasswordExpired', 'PasswordNeverExpires', 'PasswordNotRequired', 'EmailAddress', 'DisplayName', 'GivenName', `
'Surname', 'Manager', "AccountExpirationDate", "AccountLockoutTime", "AllowReversiblePasswordEncryption", `
"BadLogonCount", "CannotChangePassword", "CanonicalName", "Description", "DistinguishedName", "EmployeeID", `
"EmployeeNumber", "LastBadPasswordAttempt", "LastLogonDate", "Created", "Modified", "PrimaryGroup", "MemberOf", `
'msDS-UserPasswordExpiryTimeComputed'

and pasted into another file.. crash.

@PrzemyslawKlys
Copy link
Contributor Author

eh.. i commented and it's gone (i guess github issue is still in place)

image

I've this issue still in insider release 2.0.

Basically I've copied

$Script:UserProperties = 'Name', 'UserPrincipalName', 'SamAccountName', 'Enabled', 'PasswordLastSet', `
'PasswordExpired', 'PasswordNeverExpires', 'PasswordNotRequired', 'EmailAddress', 'DisplayName', 'GivenName', `
'Surname', 'Manager', "AccountExpirationDate", "AccountLockoutTime", "AllowReversiblePasswordEncryption", `
"BadLogonCount", "CannotChangePassword", "CanonicalName", "Description", "DistinguishedName", "EmployeeID", `
"EmployeeNumber", "LastBadPasswordAttempt", "LastLogonDate", "Created", "Modified", "PrimaryGroup", "MemberOf", `
'msDS-UserPasswordExpiryTimeComputed'

And pasted and it crashed. But seeing now.. it may have been related to me accidentally removing closing brace and then pasting...

1540204749-cadee31e-1c25-44b7-af0b-5104ee2efe861540194055613.zip

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Dec 10, 2018

Tracked in a separate issue.

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

2 participants