PowerShell / PowerShell/PowerShell
Class help provider supports only one help entry
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 55.5k
- Forks
- 8.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 88
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The PSClassHelpProvider supports only one entry in any help file describing content because each help entry read by the provider is cached under the same key, the key being the path to the help file. The name of the class is discarded, the value in the cache is therefore the last help item read from a help file.
If a module exists as follows:
New-Item module -ItemType Directory -Force
Set-Content -Path module\module.psm1 -Value @'
<#
.EXTERNALHELP module-help.xml
#>
class first {
[string]
$property
}
class second {
[void] Method() { }
}
'@
And that module has a help file containing entries for classes:
Set-Content module\module-help.xml -Value @'
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<helpItems schema="maml" xmlns="http://msh">
<command:class xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schema.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http//msdn.microsoft.com/mshelp">
<command:title>first</command:title>
<command:introduction>
<maml:para>first description.</maml:para>
</command:introduction>
<command:members>
<command:member type="field">
<command:introduction>
<maml:para>property description.</maml:para>
</command:introduction>
<command:fieldData>
<command:name>property</command:name>
<dev:type>
<maml:name>string</maml:name>
</dev:type>
</command:fieldData>
</command:member>
</command:members>
</command:class>
<command:class xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schema.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http//msdn.microsoft.com/mshelp">
<command:title>second</command:title>
<command:introduction>
<maml:para>second description.</maml:para>
</command:introduction>
<command:members>
<command:member type="method">
<command:title>Method</command:title>
<command:introduction>
<maml:para>method description.</maml:para>
</command:introduction>
<command:Parameters />
<command:returnValue>
<dev:type>
<maml:name>void</maml:name>
</dev:type>
</command:returnValue>
</command:member>
</command:members>
</command:class>
</helpItems>
'@
Content is made available to the help system as follows:
try {
$restore = $env:PSModulePath
$env:PSModulePath = $pwd.Path + [System.IO.Path]::PathSeparator + $env:PSModulePath
Import-Module .\module\module.psm1
Get-Help first -Category class
} catch {
throw
} finally {
$env:PSModulePath = $restore
}
The Help system should be able to provide help content for each of the named classes.
Expected behavior
PS> Get-Help first -Category class
NAME
first
SYNOPSIS
first description.
RELATED LINKS
REMARKS
To see the examples, type: "Get-Help second -Examples"
For more information, type: "Get-Help second -Detailed"
For technical information, type: "Get-Help second -Full"
Actual behavior
PS> Get-Help first -Category class
NAME
second
SYNOPSIS
second description.
RELATED LINKS
REMARKS
To see the examples, type: "Get-Help second -Examples"
For more information, type: "Get-Help second -Detailed"
For technical information, type: "Get-Help second -Full"
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PSClassHelpProvider and reproduce the issue using the supplied module, module-help.xml, and Get-Help first -Category class commands. Trace how entries are cached by help-file path; done means Get-Help returns the matching description and members for each named class in the same help file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100