Skip to content

Get-Help -Parameter does not correctly set PSTypeName when one parameter is declared #8697

@indented-automation

Description

@indented-automation

Steps to reproduce

function test {
    <#
    .SYNOPSIS
        Synopsis
    .DESCRIPTION
        Description
    .EXAMPLE
        test -First 1
    #>

    param (
        # First
        $First
    )
}
Get-Help test -Parameter First
(Get-Help test -Parameter First).PSTypeNames

Expected behavior

Expected to display:

-First <Object>
    First

    Required?                    false
    Position?                    1
    Default value
    Accept pipeline input?       false
    Accept wildcard characters?  false

MamlCommandHelpInfo#parameter

Actual behavior

type           : @{name=Object}
parameterValue : Object
description    : {@{Text=First}}
defaultValue   :
name           : First
required       : false
globbing       : false
pipelineInput  : false
position       : 1

System.Management.Automation.PSCustomObject
System.Object

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.0-preview.3
PSEdition                      Core
GitCommitId                    6.2.0-preview.3
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Other information

The problem exhibits for both basic and advanced functions. It applies whether the parameter help is written above the parameter (as in the example), or using the .PARAMETER <Name> tag in CBH.

This problem exhibits in PowerShell 5.1 as well. It is inherited, not unique to Core. But it could be fixed here at least.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Interactive-HelpSystemhelp infrastructure and formatting of help

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions