[release/v7.6.2] Enable usage in AppContainers#27423
Merged
daxian-dbw merged 1 commit intoMay 13, 2026
Merged
Conversation
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Backports the AppContainer initialization fix to release/v7.6.2 by avoiding false “drive doesn’t exist” conclusions when access to the system-drive root is denied, allowing filesystem PSDrives (and therefore module autoloading/cmdlet discovery) to work in AppContainer environments.
Changes:
- Replaces fixed-drive root existence checks with a new helper that treats
UnauthorizedAccessExceptionas evidence the path exists. - Uses
Environment.SpecialFolderOption.DoNotVerifywhen resolving the user’sMyDocumentspath on Windows to avoid verification failures in restricted environments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/System.Management.Automation/namespaces/FileSystemProvider.cs | Adds SafeDoesPathExist and uses it for fixed-drive/root validation to support AppContainer-restricted volume roots. |
| src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs | Resolves MyDocuments with DoNotVerify on Windows to avoid access/verification issues in constrained contexts. |
Comment on lines
+1247
to
+1250
| catch | ||
| { | ||
| return false; | ||
| } |
SeeminglyScience
approved these changes
May 13, 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 #27266 to release/v7.6.2
Triggered by @daxian-dbw 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 issue #27253 where PowerShell fails to initialize in AppContainer environments. By default, AppContainers block access to the root of the system drive. PowerShell was incorrectly treating "access denied" as the drive not existing, causing initialization failures and preventing modules from loading.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Validated by the original PR. Testing can only be done interactively in an AppContainer environment. The fix treats "access denied" on the root of the system drive as evidence the drive exists, rather than treating it as absent.
Risk
REQUIRED: Check exactly one box.
Small targeted fix that changes how PowerShell treats "access denied" errors when checking drive accessibility in AppContainer environments. The change is additive — it only affects AppContainer scenarios where the root of the system drive is blocked.