Skip to content

fix: Refactor GetModifiedSettingsContent for PS5 compatibility#2286

Open
ChrisBlankDe wants to merge 4 commits into
microsoft:mainfrom
ChrisBlankDe:fix2285
Open

fix: Refactor GetModifiedSettingsContent for PS5 compatibility#2286
ChrisBlankDe wants to merge 4 commits into
microsoft:mainfrom
ChrisBlankDe:fix2285

Conversation

@ChrisBlankDe

@ChrisBlankDe ChrisBlankDe commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

❔What, Why & How

This pull request makes a targeted improvement to the way the $schema property is handled in the GetModifiedSettingsContent function. The change ensures compatibility with PowerShell 5 by explicitly listing properties instead of using a wildcard, which could cause issues in that version.

  • Improved PowerShell 5 compatibility by explicitly listing property names in Select-Object rather than using a wildcard, preventing the literal * property from being added when reordering $schema to the first position in the settings object.

Related to issue: #2285

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

Copilot AI review requested due to automatic review settings June 19, 2026 10:52
@ChrisBlankDe ChrisBlankDe requested a review from a team as a code owner June 19, 2026 10:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a PowerShell 5 incompatibility in GetModifiedSettingsContent where reordering the $schema property via Select-Object ..., * -ExcludeProperty '$schema' could incorrectly introduce a literal "*": null entry in the resulting settings JSON. It updates the implementation to explicitly select properties in the desired order and documents the fix in the release notes.

Changes:

  • Refactors $schema reordering in GetModifiedSettingsContent to avoid Select-Object * and be PowerShell 5-safe.
  • Adds a release note entry referencing issue #2285 and the "*": null invalid JSON symptom.

Reviewed changes

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

File Description
RELEASENOTES.md Documents the fix for issue #2285 in the release notes.
Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Updates $schema property reordering logic to avoid PS5 adding a literal "*" property.

Comment thread Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Outdated
Comment thread Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants