We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am expecting the same behaviour between the PowerShell Extension terminal and the standard PowerShell terminal.
PowerShell Extension
It appears that there is a scoping issue or not cleaning up of variable names within the PowerShell Extension terminal.
Name Value ---- ----- PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.20348 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 Name : ConsoleHost Version : 7.4.1 InstanceId : 1a36e6cd-b018-4307-8cf6-1068ec5a11bf UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : en-US CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace
1.86.2 903b1e9d8990623e3d7da1df3d33db3e42d80eda x64
ms-vscode.powershell@2024.3.0
Param ( [int]$MaxConcurrentJobs = 2 ) $Tasks = @( @{ Type = 'PC' Actions = @( @{ ComputerName = 'PC1' Result = $null } @{ ComputerName = 'PC2' Result = $null } ) } @{ Type = 'SERVER' Actions = @( @{ ComputerName = 'SERVER1' Result = $null } @{ ComputerName = 'SERVER2' Result = $null } ) } ) $outerScriptBlock = { $task = $_ $innerScriptBlock = { $action = $_ if (-not $MaxConcurrentJobs) { $task = $using:task } $action.Result = '{0} - {1}' -f $task.Type, $action.ComputerName } $innerForeachParams = @{ Process = $innerScriptBlock } if (-not $MaxConcurrentJobs) { $innerForeachParams = @{ Parallel = $innerScriptBlock ThrottleLimit = $using:MaxConcurrentJobs } } $task.Actions | ForEach-Object @innerForeachParams } $foreachParams = @{ Process = $outerScriptBlock } if ($MaxConcurrentJobs -gt 1) { $foreachParams = @{ Parallel = $outerScriptBlock ThrottleLimit = $MaxConcurrentJobs } } $Tasks | ForEach-Object @foreachParams $Tasks.Actions.Result
Test.ps1
$MaxConcurrentJobs = 1
F5
$MaxConcurrentJobs = 2
& 'T:\Test\Brecht\PowerShell\Test.ps1' -MaxConcurrentJobs 2 # no error
& 'T:\Test\Brecht\PowerShell\Test.ps1' -MaxConcurrentJobs 1 # no error
& 'T:\Test\Brecht\PowerShell\Test.ps1' -MaxConcurrentJobs 2 # ERROR
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prerequisites
Summary
I am expecting the same behaviour between the
PowerShell Extension
terminal and the standard PowerShell terminal.It appears that there is a scoping issue or not cleaning up of variable names within the
PowerShell Extension
terminal.PowerShell Version
Visual Studio Code Version
Extension Version
ms-vscode.powershell@2024.3.0
Steps to Reproduce
Test.ps1
Execute in terminal
PowerShell Extension
:Step 1
Test.ps1
with$MaxConcurrentJobs = 1
and pressF5
# no errorTest.ps1
with$MaxConcurrentJobs = 2
and pressF5
# no errorStep 2
Execute in a standard PowerShell 7 terminal:
Step 1
Step 2
Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: