Skip to content

Conversation

sdwheeler
Copy link
Collaborator

@sdwheeler sdwheeler commented Mar 26, 2025

PR Summary

Add notes about the __AllParameterSets name

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributors guide.
  • Style: This PR adheres to the style guide.

Copy link
Contributor

Learn Build status updates of commit a7ed3c0:

✅ Validation status: passed

File Status Preview URL Details
reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-5.1)
reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.5)
reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.6)

For more details, please refer to the build report.

For any questions, please:

@sdwheeler sdwheeler force-pushed the sdw-w410960-i11955 branch from a7ed3c0 to 6d9a0b6 Compare March 26, 2025 19:05
Copy link
Contributor

Learn Build status updates of commit 6d9a0b6:

✅ Validation status: passed

File Status Preview URL Details
reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-5.1)
reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.5)
reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md ✅Succeeded View (powershell-7.6)

For more details, please refer to the build report.

For any questions, please:

@sdwheeler sdwheeler merged commit d8feba0 into MicrosoftDocs:main Mar 26, 2025
4 checks passed
@sdwheeler sdwheeler deleted the sdw-w410960-i11955 branch March 28, 2025 17:42
@indented-automation
Copy link
Contributor

Flagging and will try and find a moment to edit. But this assertion is incorrect (came up in the / a PS discord):

- Setting **DefaultParameterSetName** to `__AllParameterSets` in the
  `[CmdletBinding()]` attribute has no effect.

It will cause creation of an explicit parameter set if the value is set to __AllParameterSets, but the result will be quite confusing (for a named set).

It would have been nice if PS would outright reject the value, but since it doesn't it perhaps just needs a "__AllParameterSets should not be explicitly used as the DefaultParameterSetName" or similar.

This will have two parameter sets:

function a { [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')]param ( [Parameter(ParameterSetName = 'NotDefault')]$a ) }
gcm a -synt

This only has one:

function a { [CmdletBinding()]param ( [Parameter(ParameterSetName = 'NotDefault')]$a ) }
gcm a -synt

Tested in 5.1 and 7.5, but if it differs anywhere I'd be very surprised.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc __AllParameterSets in about_Parameter_Sets?

2 participants