[release/v7.5] Fix Progress Preference variable in adv functions#26791
Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from Feb 12, 2026
Merged
Conversation
…werShell#24591) Co-authored-by: Dongbo Wang <[email protected]>
Contributor
There was a problem hiding this comment.
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" |
jshigetomi
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Customer Impact
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.
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.
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.