[release/v7.6.7] Tolerate IO/JSON errors reading the per-user powershell.config.json - #28084
Merged
Aditya Patwardhan (adityapatwardhan) merged 1 commit intoSep 24, 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 24, 2026 05:09
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved handling and test coverage gaps affect the promised behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This backport makes per-user configuration errors non-fatal while preserving strict system-wide configuration handling.
Changes:
- Adds fallback warnings for current-user configuration failures.
- Adds localized warning messages.
- Adds regression coverage for fallback behavior.
Unresolved issues remain around unreadable-file warning behavior and coverage for I/O and security-sensitive configuration cases.
| File | Summary |
|---|---|
test/xUnit/csharp/test_PSConfiguration.cs |
Adds configuration fallback and warning tests. |
src/System.Management.Automation/resources/PSConfigurationStrings.resx |
Adds localized fallback warning messages. |
src/System.Management.Automation/engine/PSConfiguration.cs |
Implements tolerant current-user configuration loading. |
💡 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)) |
Justin Chung (jshigetomi)
approved these changes
Sep 24, 2026
Aditya Patwardhan (adityapatwardhan)
merged commit Sep 24, 2026
b613dd7
into
PowerShell:release/v7.6.7
44 of 46 checks passed
Aditya Patwardhan (adityapatwardhan)
deleted the
backport/release/v7.6.7/27373-84a930151
branch
September 24, 2026 17:15
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.6.7
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
Fixes #27370, where PowerShell can fail during startup when the per-user powershell.config.json is unreadable because a cloud file provider such as OneDrive is not running, access is denied, JSON is malformed, or a value has the wrong shape. Expected behavior is a warning and fallback to default current-user settings; system-wide configuration errors remain hard failures.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The original PR added xUnit coverage for malformed and unreadable current-user configuration files, type-mismatched values, fallback-to-default behavior, warning emission to stderr, and continued strict failure for the all-users configuration. The backport cherry-picked cleanly onto the latest upstream release/v7.6.7; the worktree is clean, the branch is exactly one commit ahead of the target, and git diff --check passed. CI will provide release-branch build and test validation.
Risk
REQUIRED: Check exactly one box.
Medium risk because this changes early-startup configuration handling in the engine. The change is scoped to current-user configuration failures, preserves fail-closed behavior for the security-relevant all-users configuration, and includes focused xUnit coverage for both fallback paths and warning output.