[release/v7.5.7] Fix checks for local user config file paths#27459
Merged
adityapatwardhan merged 2 commits intoMay 18, 2026
PowerShell:release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
adityapatwardhan:backport/release/v7.5.7/26269-c7ee0d294adityapatwardhan/PowerShell:backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard
Merged
[release/v7.5.7] Fix checks for local user config file paths#27459adityapatwardhan merged 2 commits intoPowerShell:release/v7.5.7PowerShell/PowerShell:release/v7.5.7from adityapatwardhan:backport/release/v7.5.7/26269-c7ee0d294adityapatwardhan/PowerShell:backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard
adityapatwardhan merged 2 commits into
PowerShell:release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
adityapatwardhan:backport/release/v7.5.7/26269-c7ee0d294adityapatwardhan/PowerShell:backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This backport updates user-local path derivation and guard logic so PowerShell avoids using invalid local config/cache locations when special folders are unavailable.
Changes:
- Uses
DoNotVerifyfor Windows special-folder path lookup and adds safer cache/config path derivation. - Skips telemetry, update notification cache, module analysis cache, profile optimization, and config reads when cache/config paths are unavailable.
- Adds guards around profile and transcript path generation for empty user path scenarios.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/System.Management.Automation/CoreCLR/CorePsPlatform.cs |
Adds safe special-folder derivation and cache path helper methods. |
src/System.Management.Automation/engine/PSConfiguration.cs |
Skips current-user config file reads when no user config path exists. |
src/System.Management.Automation/engine/Modules/AnalysisCache.cs |
Avoids module cache serialization when no cache path is available. |
src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs |
Adds a transcript path guard for unavailable base directories. |
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs |
Applies empty base-path handling to both current-user and all-users profiles. |
src/System.Management.Automation/engine/CommandDiscovery.cs |
Uses DoNotVerify when expanding ~ in PATH lookup entries. |
src/System.Management.Automation/utils/Telemetry.cs |
Disables telemetry when the UUID cache path cannot be derived. |
src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs |
Derives update notification cache path through the new cache helper. |
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs |
Skips profile optimization setup when no cache directory is available. |
Comment on lines
+92
to
+95
| if (!string.IsNullOrEmpty(perUserConfigDirectory)) | ||
| { | ||
| perUserConfigFile = Path.Combine(perUserConfigDirectory, ConfigFileName); | ||
| } |
Comment on lines
+1159
to
+1162
| if (string.IsNullOrEmpty(baseDirectory)) | ||
| { | ||
| return string.Empty; | ||
| } |
SeeminglyScience
approved these changes
May 18, 2026
This was referenced May 18, 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 #26269 to release/v7.5.7
Triggered by @adityapatwardhan on behalf of @SeeminglyScience
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 user configuration path handling so SYSTEM uses the expected default config location and skips user config loading when the configured Documents folder resolves to an empty/whitespace path.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Cherry-pick completed onto release/v7.5.7 and conflict resolution preserved release-specific telemetry module lists while applying the config-path fix logic. The changed files match the original PR scope and the backport commit applied cleanly after resolving one conflict in Telemetry.cs.
Risk
REQUIRED: Check exactly one box.
Change is scoped to path derivation and guard logic for user config locations. The backport keeps existing release branch behavior outside this targeted fix, minimizing regression surface.
Merge Conflicts
Resolved one conflict in src/System.Management.Automation/utils/Telemetry.cs by preserving release/v7.5.7 content and applying the intended CanSendTelemetry/telemetry.uuid path derivation update from PR #26269.