Skip to content

Debugger hangs when encountering certain issues #2064

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
johndog opened this issue Jul 3, 2019 · 1 comment
Closed

Debugger hangs when encountering certain issues #2064

johndog opened this issue Jul 3, 2019 · 1 comment

Comments

@johndog
Copy link

johndog commented Jul 3, 2019

Issue Description

This is an issue I'm trying to debug:

% : Index operation failed; the array index evaluated to null.
At D:\repos\devdir\parse-buildlog.ps1:147 char:110
+ ... string -Pattern "don't know how to make '(.*)'"| Select-Group 1 | % {
+                                                                       ~~~
    + CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex,Microsoft.PowerShell.Commands.ForEachObjectCommand

If I attach to the running script prior to this occurring, I can step through the code for a while. If I hit F5 to resume execution to the point of the exception, the debugger hangs forever with a spinning progress wheel in the status bar.

Attached Logs

This appears in the EditorServices log about the time of the hang:

2019-07-03 10:03:57.366 [ERROR] tid:70 in 'ResumeDebugger' C:\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs: line 1243
    Tried to resume debugger with action Continue but there was no debuggerStoppedTask.

2019-07-03 10:04:11.394 [ERROR] tid:16 in 'ExecuteCommandAsync' C:\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs: line 623
    Exception occurred while executing debugger command:
    
    System.Management.Automation.RemoteException: The scope number '3' exceeds the number of active scopes.
    Parameter name: scopeID
    Actual value was 3.
       at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
       at System.Management.Automation.PowerShell.CoreInvokeRemoteHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
       at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
       at System.Management.Automation.RemoteDebugger.ProcessCommand(PSCommand command, PSDataCollection`1 output)
       at Microsoft.PowerShell.EditorServices.Session.PowerShell5Operations.ExecuteCommandInDebugger[TResult](PowerShellContext powerShellContext, Runspace currentRunspace, PSCommand psCommand, Boolean sendOutputToHost, Nullable`1& debuggerResumeAction)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.ExecuteCommandInDebugger[TResult](PSCommand psCommand, Boolean sendOutputToHost)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.<ExecuteCommandAsync>d__74`1.MoveNext()

2019-07-03 10:04:30.318 [ERROR] tid:70 in 'ListenForMessagesAsync' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: line 344
    Stream terminated unexpectedly, ending MessageDispatcher loop
    
    Exception: EndOfStreamException
    MessageReader's input stream ended unexpectedly, terminating.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17763
VSCode 1.34.0
PowerShell Extension Version 2019.5.0

PowerShell Information

Name Value
PSVersion 5.1.17763.503
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17763.503
BuildVersion 10.0.17763.503
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
gitlens eamodio 9.8.2
perl-outline hitode909 0.0.4
powershell-preview ms-vscode 2019.5.0
vscode-hexdump slevesque 1.7.2
@SydneyhSmith
Copy link
Collaborator

Thanks for reporting this @johndog this issue looks similar to #1856 and is likely the result of a race condition between PSReadline, the extension and the command being invoked. For now we are tracking this needed architectural maintenance with #1856 and #1793 so I will close 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

3 participants