GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Find help again after the help cache is reset by ChrisTX · Pull Request #28294 · PowerShell/PowerShell

Conversation

@ChrisTX

@ChrisTX Christian Pfeiffer (ChrisTX) commented Oct 30, 2026

Copy link
Copy Markdown

PR Summary

Fixes #28274.

When Get-Help finds the help of a cmdlet or function in a file, CommandHelpProvider sets the HelpFile property of the command to the full path of that file. From then on, FindHelpFile()/GetHelpFile() load that path directly instead of searching for the help.

Reset() runs after Update-Help and when the UI culture changes. It clears the cached help, but leaves those full paths in place, so the session keeps loading the help from the same file:

  • After Update-Help -Scope CurrentUser, help in $PSHOME that was loaded before keeps winning over the newly installed CurrentUser help, which is searched first otherwise (Get-Help keeps returning help it already loaded after Update-Help -Scope CurrentUser, which makes HelpSystem.Tests.ps1 flaky when $PSHOME has help #28274).
  • After the UI culture changes, the help stays in the previous culture.

This PR makes CommandHelpProvider keep the original HelpFile value of every command it changes, and Reset() restores those values, so the help is searched for again. The original values are kept in a ConditionalWeakTable, so commands of removed modules aren't kept alive until the next reset. HelpFile still shows the full path of the help file after Get-Help, as before.

The new test in HelpSystem.Tests.ps1 covers the UI culture case, as it doesn't need help in $PSHOME: a script module with help in en-US and de-DE, Get-Help in en-US, then in de-DE. Without the fix, the second Get-Help returns the en-US help.

PR Context

Get-Help in a session returns outdated help after Update-Help or a change of the UI culture, until a new session is started. This also makes HelpSystem.Tests.ps1 fail when $PSHOME contains help: "Validate that get-help works for CurrentUserScope" installs the test help in the CurrentUser scope, but gets the help from $PSHOME that an earlier test loaded.

I built and tested the change on 7.6.9 (HelpSystem.Tests.ps1 passes, including with help in $PSHOME, and the new test fails without the fix). It applies cleanly to master, but I don't have the .NET 11 SDK master needs here, so the build on master is left to CI.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge. If this PR is a work in progress, please open this as a Draft Pull Request and mark it as Ready to Review when it is ready to merge.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ChrisTX @claude
Find help again after the help cache is reset
833b423
When Get-Help finds the help of a cmdlet or function in a file, it sets
the HelpFile property of the command to the full path of that file, and
a full path in HelpFile is loaded directly from then on. Reset(), which
runs after Update-Help and when the UI culture changes, cleared the
cached help but kept those paths, so the session kept getting the help
from the same file: the help Update-Help installed in the CurrentUser
scope wasn't found when help in $PSHOME had been loaded before, and the
help stayed in the previous UI culture.

CommandHelpProvider now keeps the original HelpFile of the commands it
changes, and Reset() restores them.

Fixes PowerShell#28274

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 23:28
@ChrisTX
Christian Pfeiffer (ChrisTX) requested review from a team, Aditya Patwardhan (adityapatwardhan) and Dongbo Wang (daxian-dbw) as code owners October 30, 2026 23:28
@azure-pipelines

azure-pipelines Bot commented Oct 30, 2026

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of Christian Pfeiffer (ChrisTX) October 30, 2026 23:29
View session
Copilot AI reviewed Oct 30, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the changes to help rediscovery after cache resets.

No open issues 🎉

What changed in this PR

Fixes #28274 by making Get-Help search for help again after a cache reset, rather than reuse a previously resolved file path after Update-Help or a UI culture change.

Changes:

  • Tracks original command help paths with weak references and restores them on reset.
  • Adds a regression test that verifies help switches from en-US to de-DE when the UI culture changes.
File Description
test/​powershell/​engine/​Help/​HelpSystem.Tests.ps1 Tests help rediscovery after a UI culture change.
src/​System.Management.Automation/​help/​CommandHelpProvider.cs Saves original help paths and restores them when clearing the help cache.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Nov 7, 2026
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan adityapatwardhan is a code owner
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw daxian-dbw is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Get-Help keeps returning help it already loaded after Update-Help -Scope CurrentUser, which makes HelpSystem.Tests.ps1 flaky when $PSHOME has help

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ChrisTX
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.