-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Interactive-Consolethe console experiencethe console experienceWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group
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 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:
- Is the help syntax incorrect?
- 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 -CompletedExpected behavior
PS>.\repro.ps1
Write-Progress [[-Activity] <System.String>] ...
Mandatory : FalseActual behavior
PS>.\repro.ps1
Write-Progress [-Activity] <System.String> ...
Mandatory : FalseError 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.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Interactive-Consolethe console experiencethe console experienceWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group