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

Exception in log during debug - debugger acting non-responsive #345

Closed
rkeithhill opened this issue Jan 19, 2017 · 7 comments
Closed

Exception in log during debug - debugger acting non-responsive #345

rkeithhill opened this issue Jan 19, 2017 · 7 comments
Labels

Comments

@rkeithhill
Copy link
Collaborator

This is the stack trace (I've attached the full log file):

1/18/2017 7:58:19 PM [ERROR] - Method "ExecuteCommand" at line 476 of C:\Users\Keith\GitHub\rkeithhill\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Runtime exception occurred while executing command:
    
    System.Management.Automation.CmdletInvocationException: The scope number '3' exceeds the number of active scopes.
    Parameter name: scopeID
    Actual value was 3. ---> System.Management.Automation.PSArgumentOutOfRangeException: The scope number '3' exceeds the number of active scopes.
    Parameter name: scopeID
    Actual value was 3.
       at System.Management.Automation.SessionStateInternal.GetScopeByID(Int32 scopeID)
       at System.Management.Automation.SessionStateInternal.GetScopeByID(String scopeID)
       at System.Management.Automation.SessionStateInternal.GetVariableTableAtScope(String scopeID)
       at Microsoft.PowerShell.Commands.VariableCommandBase.GetMatchingVariables(String name, String lookupScope, Boolean& wasFiltered, Boolean quiet)
       at Microsoft.PowerShell.Commands.GetVariableCommand.ProcessRecord()
       at System.Management.Automation.CommandProcessor.ProcessRecord()
       --- End of inner exception stack trace ---
       at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
       at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
       at System.Management.Automation.PowerShell.CoreInvokeHelper[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.PowerShell.InvokeWithDebugger(IEnumerable`1 input, IList`1 output, PSInvocationSettings settings, Boolean invokeMustRun)
       at System.Management.Automation.ScriptDebugger.ProcessCommand(PSCommand command, PSDataCollection`1 output)
       at Microsoft.PowerShell.EditorServices.Session.PowerShell4Operations.ExecuteCommandInDebugger[TResult](PowerShellContext powerShellContext, Runspace currentRunspace, PSCommand psCommand, Boolean sendOutputToHost)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.ExecuteCommandInDebugger[TResult](PSCommand psCommand, Boolean sendOutputToHost)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.<ExecuteCommand>d__40`1.MoveNext()

I just updated to the latest of PSES and vscode-powershell and am using those bits.

1484794581-d6e1949c-04ff-4ef8-9f75-620ba66b16ba1484794578279.zip

@daviwil daviwil added the Issue-Bug A bug to squash. label Jan 29, 2017
@daviwil daviwil added this to the 0.9.1 milestone Jan 29, 2017
@kapilmb
Copy link

kapilmb commented Feb 10, 2017

Can you please provide steps for reproducing this case. I looked at the logs and it appears posh-git\test\testDebugHarness.ps1 was being debugged but I cannot reproduce the hang.

@daviwil daviwil modified the milestones: 0.9.1, 0.10.1, 0.10.2 Mar 14, 2017
@daviwil daviwil modified the milestones: 0.10.2, April 2017 Apr 4, 2017
@daviwil daviwil modified the milestones: June 2017, Backlog Oct 27, 2017
@TylerLeonhardt
Copy link
Member

I don't think this repros anymore, does it @rkeithhill?

@rkeithhill
Copy link
Collaborator Author

I think I fixed this a while back. If not, keep an eye out for:

PSArgumentOutOfRangeException: The scope number 'n' exceeds the number of active scopes.

In log files.

@TylerLeonhardt
Copy link
Member

Sounds good. Closing for now.

@glen-nicol
Copy link

My coworker and I see this in our VS code output. I am using 1.7.0 of the powershell extension and 1.23.1 of VS code on windows.

The scope number '2' exceeds the number of active scopes.
Parameter name: scopeID
Actual value was 2.
The scope number '1' exceeds the number of active scopes.
Parameter name: scopeID
Actual value was 1.

Our scripts may be doing something unconventional though. We have scripts calling other scripts like this:

& $deployscript -deployment_dir $packageDir -actionType $actionType -configuration $configuration

We do not see these errors if we run through normal powershell prompt/ command line.

Where would I look for log files to help you guys narrow down root cause?

@TylerLeonhardt
Copy link
Member

Strange... These steps would be a good place to start!:
https://github.com/powershell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

@glen-nicol
Copy link

glen-nicol commented Jun 11, 2018

logs.zip
I replaced the paths with what I think are equivalent substitutes.
I didn't see it anywhere in the logs. I am running PS 3.0 on Win7.
One other note. I hit 5 breakpoints during that run. And it looks like there is an error for each one. There are 4 during the nested script invokation and 1 at the top level before it runs the nested script.

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

No branches or pull requests

5 participants