Skip to content

[release/v7.4] Fix Progress Preference variable in adv functions#26865

Open
TravisEz13 wants to merge 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/24591-b502098e3
Open

[release/v7.4] Fix Progress Preference variable in adv functions#26865
TravisEz13 wants to merge 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/24591-b502098e3

Conversation

@TravisEz13
Copy link
Member

Backport of #24591 to release/v7.4

Triggered by @TravisEz13 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

Fixes -ProgressAction failures in advanced functions by restoring ProgressPreference entries; prevents engine errors when the common parameter is used.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Ran CommonParameters.Tests.ps1.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Scoped fix to common parameter handling with targeted tests.

Copilot AI review requested due to automatic review settings February 20, 2026 21:29
@TravisEz13 TravisEz13 added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 20, 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 backports a critical bug fix from #24591 to the release/v7.4 branch. The fix addresses an array out-of-bounds error that occurs when using the -ProgressAction common parameter in advanced PowerShell functions. The bug was caused by missing ProgressPreference entries in the PreferenceVariables and PreferenceVariableTypes arrays in SpecialVariables.cs, which caused index mismatches when the compiler tried to map preference variables. The fix adds the missing array entries, includes defensive assertions to prevent similar issues in the future, and adds comprehensive tests to verify the fix.

Changes:

  • Added missing ProgressPreference entries to preference variable arrays in SpecialVariables.cs
  • Added diagnostic assertions in Compiler.cs to detect array/enum mismatches at startup
  • Added comprehensive tests for -ProgressAction parameter functionality
  • Minor documentation improvement (VS Code → 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 Adds missing ProgressPreference entries to PreferenceVariables and PreferenceVariableTypes arrays to fix index mismatch
src/System.Management.Automation/engine/parser/Compiler.cs Adds defensive assertions in static constructor to verify array and enum lengths match
test/powershell/Language/Scripting/CommonParameters.Tests.ps1 Adds tests for ProgressAction parameter in both simple and complex advanced functions
docs/community/working-group-definitions.md Expands "VS Code" abbreviation to full "Visual Studio Code" name

@adityapatwardhan adityapatwardhan added the Needs-Triage The issue is new and needs to be triaged by a work group. label Feb 20, 2026
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Feb 28, 2026
@microsoft-github-policy-service
Copy link
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

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 Needs-Triage The issue is new and needs to be triaged by a work group. Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants