Enable usage in AppContainers#27266
Merged
jshigetomi merged 4 commits intoPowerShell:masterfrom Apr 20, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR aims to prevent failures when validating or discovering fixed drives and user module paths in restricted environments (e.g., AppContainers), where direct access to certain roots/special folders may be denied.
Changes:
- Replace direct fixed-drive existence checks with a helper that tolerates access-denied scenarios.
- Update default drive initialization to use the new fixed-drive validator.
- Avoid verification when retrieving the “My Documents” special folder path on Windows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/System.Management.Automation/namespaces/FileSystemProvider.cs |
Introduces IsValidFixedDrive and routes fixed-drive validation through it to avoid access-related failures. |
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs |
Uses Environment.SpecialFolderOption.DoNotVerify when reading MyDocuments to avoid verification failures. |
asklar
approved these changes
Apr 16, 2026
|
Sandboxing ps in AppContainers (which is actually lightweight and pretty fancy way of isolation in win environment) is actually nearly impossible regarding any cmd that one way or another linked to file system manipulation. Guys approve ASAP, please! I'm sure a lot of people will be thankful. |
TravisEz13
reviewed
Apr 20, 2026
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
TravisEz13
approved these changes
Apr 20, 2026
jshigetomi
approved these changes
Apr 20, 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.
PR Summary
Fixes #27253
PR Context
By default in AppContainers, the root of the system drive is not accessible. When PowerShell sees this during initialization, it assumes that the entire drive is not accessible and treats it as not being present (and therefore also stops loading pretty much everything else). This change will allow PowerShell to treat "access denied" as evidence that the drive does exist.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header