Skip to content

Problem with $arg when using debug mode #1496

Closed
@PatTheOche

Description

@PatTheOche
  • Operating system name and version: Windows 10
  • VS Code version: 1.26.1
  • PowerShell extension version: 1.8.3
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.15063.1266
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.1266
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem when $arg contains values and a breakpoint is used to test the code.
if $arg is empty, no problem.
after breakpoint, each F10 key use, another error is raised.
Launch.json example :

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File in Temporary Console",
            "script": "c:/svn/test/Untitled-1.ps1",
            "args": ["toto"],
            "cwd": "${file}",
            "createTemporaryIntegratedConsole": true
        }
    ]
}

Attached Logs

the error is :

System.Management.Automation.CmdletInvocationException: Le numéro de portée « 1 » dépasse le nombre de portées actives.
Nom du paramètre : scopeID
La valeur réelle était 1. ---> System.Management.Automation.PSArgumentOutOfRangeException: Le numéro de portée « 1 » dépasse le nombre de portées actives.
Nom du paramètre : scopeID
La valeur réelle était 1.
   à System.Management.Automation.SessionStateInternal.GetScopeByID(Int32 scopeID)
   à System.Management.Automation.SessionStateInternal.GetScopeByID(String scopeID)
   à System.Management.Automation.SessionStateInternal.GetVariableTableAtScope(String scopeID)
   à Microsoft.PowerShell.Commands.VariableCommandBase.GetMatchingVariables(String name, String lookupScope, Boolean& wasFiltered, Boolean quiet)
   à Microsoft.PowerShell.Commands.GetVariableCommand.ProcessRecord()
   à System.Management.Automation.CommandProcessor.ProcessRecord()
   --- Fin de la trace de la pile d'exception interne ---
   à System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   à System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   à System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   à System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   à System.Management.Automation.PowerShell.InvokeWithDebugger(IEnumerable`1 input, IList`1 output, PSInvocationSettings settings, Boolean invokeMustRun)
   à System.Management.Automation.ScriptDebugger.ProcessCommand(PSCommand command, PSDataCollection`1 output)
   à Microsoft.PowerShell.EditorServices.Session.PowerShell4Operations.ExecuteCommandInDebugger[TResult](PowerShellContext powerShellContext, Runspace currentRunspace, PSCommand psCommand, Boolean sendOutputToHost, Nullable`1& debuggerResumeAction)
   à Microsoft.PowerShell.EditorServices.PowerShellContext.ExecuteCommandInDebugger[TResult](PSCommand psCommand, Boolean sendOutputToHost)
   à Microsoft.PowerShell.EditorServices.PowerShellContext.<ExecuteCommand>d__48`1.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions