Skip to content

help Write-Progress shows -Activity as Mandatory #24572

@alx9r

Description

@alx9r

Prerequisites

Steps to reproduce

The code below outputs syntax help and the mandatory property of the attribute for Write-Progress and its -Activity parameter. It also invokes Write-Progress -Completed without -Activity. The help syntax has no [] around [-Activity] <System.String>. I understand this to mean the value for the parameter is mandatory (the parameter name, on the other hand, is optional). The mandatory property is false. I gather that since #18474 -Activity is meant to be optional. However, the help syntax seems to indicate the parameter is mandatory, though. This leads me to the following questions:

  1. Is the help syntax incorrect?
  2. If it is the help syntax that is incorrect, how is that help generated?

repro.ps1

Get-Help Write-Progress | % syntax
Get-Command Write-Progress | % {$_.Parameters['Activity']} | % Attributes | Select-Object Mandatory
Write-Progress -Completed

Expected behavior

PS>.\repro.ps1

Write-Progress [[-Activity] <System.String>] ...

Mandatory : False

Actual behavior

PS>.\repro.ps1

Write-Progress [-Activity] <System.String> ...

Mandatory : False

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.22631
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.WG-Interactive-Consolethe console experienceWG-NeedsReviewNeeds a review by the labeled Working Group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions