[release/v7.5.12] Tolerate IO/JSON errors reading the per-user powershell.config.json - #28070
Merged
Aditya Patwardhan (adityapatwardhan) merged 1 commit intoSep 23, 2026
Conversation
…PowerShell#27373) Co-authored-by: Justin Chung <[email protected]> Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Aditya Patwardhan (adityapatwardhan)
September 23, 2026 18:13
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Inaccessible files can be treated as missing, bypassing warnings and strict system-wide failure.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Backports tolerant handling for malformed or unreadable per-user PowerShell configuration while retaining strict system-wide behavior.
Changes:
- Adds per-user fallback warnings for IO and JSON errors.
- Adds localized warning resources.
- Adds focused fallback and warning tests.
| File | Summary |
|---|---|
test/xUnit/csharp/test_PSConfiguration.cs |
Tests fallback and warning behavior. |
src/System.Management.Automation/resources/PSConfigurationStrings.resx |
Adds warning messages. |
src/System.Management.Automation/engine/PSConfiguration.cs |
Implements configuration fallback handling. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+415
to
+417
| catch (Exception exc) when ( | ||
| scope == ConfigScope.CurrentUser && | ||
| (exc is IOException || exc is UnauthorizedAccessException || exc is SecurityException || exc is JsonException)) |
Dongbo Wang (daxian-dbw)
approved these changes
Sep 23, 2026
Justin Chung (jshigetomi)
approved these changes
Sep 23, 2026
Aditya Patwardhan (adityapatwardhan)
merged commit Sep 23, 2026
8a32d84
into
PowerShell:release/v7.5.12
36 checks passed
Aditya Patwardhan (adityapatwardhan)
deleted the
backport/release/v7.5.12/27373-84a930151
branch
September 23, 2026 21:03
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 #27373 to release/v7.5.12
Triggered by Aditya Patwardhan (@adityapatwardhan) on behalf of Justin Chung (@jshigetomi)
Original CL Label: CL-Engine
/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
Found internally after reports of PowerShell failing at startup when a per-user powershell.config.json is temporarily unreadable or malformed. The expected behavior is to warn and fall back to defaults for the current-user file while retaining strict failure for the system-wide configuration.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The original PR adds focused xUnit coverage for broken and type-mismatched current-user configuration, fallback defaults, warning emission, and continued system-wide strict failure. The backport cherry-picked cleanly and passes git diff --check, resource XML parsing, and conflict-marker scanning. A targeted dotnet test attempt was blocked during build by pre-existing missing DotNetEventingStrings generated resources in Microsoft.PowerShell.CoreCLR.Eventing, before the selected tests could run.
Risk
REQUIRED: Check exactly one box.
Medium risk because this changes early startup configuration error handling, but only for the per-user scope; the system-wide security-relevant configuration remains fail-closed. The original change includes focused xUnit coverage and cherry-picked cleanly.