Skip to content

[release/v7.5] Fix Progress Preference variable in adv functions#26791

Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from
daxian-dbw:backport/release/v7.5/24591-b502098e3
Feb 12, 2026
Merged

[release/v7.5] Fix Progress Preference variable in adv functions#26791
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from
daxian-dbw:backport/release/v7.5/24591-b502098e3

Conversation

@daxian-dbw
Copy link
Member

Backport of #24591 to release/v7.5

Triggered by @daxian-dbw on behalf of @cmkb3

Original CL Label: CL-General

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Customers reported that the -ProgressAction parameter doesn't work in advanced functions (issues #21074 and #20657), causing array out of bounds and type errors.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

New tests were added in the original PR to verify the fix for the array out of bounds/type error when using -ProgressAction parameter in advanced functions.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

This is a targeted bug fix for array indexing errors with the -ProgressAction parameter. The fix adds the missing ProgressPreference entry to reference variable and type arrays. Tests were included in the original PR.

Copilot AI review requested due to automatic review settings February 12, 2026 19:12
@daxian-dbw daxian-dbw added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a backport of #24591 to the release/v7.5 branch, fixing a critical bug where the -ProgressAction common parameter caused array out of bounds and type cast errors in advanced PowerShell functions. The root cause was that ProgressPreference was missing from the PreferenceVariables and PreferenceVariableTypes arrays in SpecialVariables.cs, while being defined in the PreferenceVariable enum, causing index mismatches during preference variable processing.

Changes:

  • Added ProgressPreference to both PreferenceVariables and PreferenceVariableTypes arrays to fix array indexing errors
  • Added diagnostic assertions to prevent similar mismatches between arrays and enum in the future
  • Added comprehensive test coverage for the -ProgressAction parameter with advanced functions
  • Minor documentation improvement expanding "VS Code" to "Visual Studio Code"

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/System.Management.Automation/engine/SpecialVariables.cs Added ProgressPreference entry to both PreferenceVariables and PreferenceVariableTypes arrays at the correct position
src/System.Management.Automation/engine/parser/Compiler.cs Added static assertions to verify array and enum lengths match, preventing future synchronization issues
test/powershell/Language/Scripting/CommonParameters.Tests.ps1 Added two test cases validating -ProgressAction works correctly in both simple and complex advanced functions
docs/community/working-group-definitions.md Expanded abbreviation "VS Code" to full product name "Visual Studio Code"

@daxian-dbw daxian-dbw merged commit 8381df3 into PowerShell:release/v7.5 Feb 12, 2026
38 of 40 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.5/24591-b502098e3 branch February 12, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants