-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New-Guid -Empty ignores an explicit $false value #25276
Copy link
Copy link
Closed
Labels
Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Metadata
Metadata
Assignees
Labels
Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Type
Projects
Status
Reviewed
Prerequisites
This is one of many instances of a shipped command that doesn't behave correctly when a switch parameter is explicitly passed a
$falsevalue.For context, see:
$falsevalue passed to a switch parameter #25242Steps to reproduce
Expected behavior
New-Guidemits a non-empty[guid]instance. For example:Actual behavior
The
$falsevalue is ignored and an empty[guid]instance is emitted.New-Guiduses the selected parameter set name (Empty), which is based on the presence of the switch parameter (not its value), to determine the behavior.PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs
Line 52 in f194359
Behavior should be determined by the value of the
Emptyproperty instead.Environment data