Skip to content

Enable usage in AppContainers#27266

Merged
jshigetomi merged 4 commits intoPowerShell:masterfrom
SeeminglyScience:fix-app-container-issue
Apr 20, 2026
Merged

Enable usage in AppContainers#27266
jshigetomi merged 4 commits intoPowerShell:masterfrom
SeeminglyScience:fix-app-container-issue

Conversation

@SeeminglyScience
Copy link
Copy Markdown
Contributor

@SeeminglyScience SeeminglyScience commented Apr 14, 2026

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

@SeeminglyScience SeeminglyScience requested a review from a team as a code owner April 14, 2026 22:49
Copilot AI review requested due to automatic review settings April 14, 2026 22:49
@SeeminglyScience SeeminglyScience added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Apr 14, 2026
@SeeminglyScience SeeminglyScience changed the title WIP: Stop catastrophic drive errors in AppContainers WIP: Enable usage in AppContainers Apr 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs
@SeeminglyScience SeeminglyScience changed the title WIP: Enable usage in AppContainers Enable usage in AppContainers Apr 16, 2026
@gribkovav
Copy link
Copy Markdown

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.

Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
Comment thread src/System.Management.Automation/namespaces/FileSystemProvider.cs Outdated
TravisEz13 and others added 3 commits April 20, 2026 11:47
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>
@jshigetomi jshigetomi merged commit 2475feb into PowerShell:master Apr 20, 2026
44 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.6.x-Consider CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileSystem PSDrives not mounted when PowerShell runs inside an AppContainer

6 participants