Skip to content

Fix FileOnlyEntry crashing on older versions of Windows - #27880

Merged
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
SeeminglyScience:fix-file-only-entry
Aug 26, 2026
Merged

Fix FileOnlyEntry crashing on older versions of Windows#27880
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
SeeminglyScience:fix-file-only-entry

Conversation

@SeeminglyScience

Copy link
Copy Markdown
Contributor

PR Summary

Fixes an issue where the FileOnlyEntry change was crashing older versions of PowerShell. Now EntryPointNotFound exceptions will be caught and treated like a false result.

PR Context

PR Checklist

Copilot AI lite review requested due to automatic review settings August 21, 2026 20:52
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@SeeminglyScience Patrick Meinecke (SeeminglyScience) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents SystemPolicy.IsFileOnlyEntryEnabled() from crashing on older Windows versions where WldpGetApplicationSettingBoolean (or its containing DLL) may be unavailable, by catching DllNotFoundException / EntryPointNotFoundException and treating the setting as disabled.

Changes:

  • Introduced a helper that wraps WldpGetApplicationSettingBoolean and catches missing-DLL/entrypoint exceptions.
  • Updated the FileOnlyEntry setting query path to use the helper and preserve existing “treat failures as false” behavior.
  • Added ETW logging for the exception/fallback path.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/System.Management.Automation/security/wldpNativeMethods.cs Outdated

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@daxian-dbw

Copy link
Copy Markdown
Member

Close and re-open the issue to trigger CI runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.4.x-Approved Backport-7.5.x-Approved Backport-7.6.x-Done 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.

4 participants