Fixes #11955 - Add notes about the __AllParameterSets name#11956
Fixes #11955 - Add notes about the __AllParameterSets name#11956sdwheeler merged 1 commit intoMicrosoftDocs:mainfrom
Conversation
|
Learn Build status updates of commit a7ed3c0: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
a7ed3c0 to
6d9a0b6
Compare
|
Learn Build status updates of commit 6d9a0b6: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
|
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 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 -syntThis only has one: function a { [CmdletBinding()]param ( [Parameter(ParameterSetName = 'NotDefault')]$a ) }
gcm a -syntTested in 5.1 and 7.5, but if it differs anywhere I'd be very surprised. |
PR Summary
Add notes about the __AllParameterSets name
__AllParameterSetsinabout_Parameter_Sets? #11955PR Checklist