-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Pseudobinding assumes all ValueFromPipeline parameters get a value from the pipeline #27121
Copy link
Copy link
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.
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
If you define a function with 2 pipeline inputs like this:
function Test
{
Param
(
[Parameter(ValueFromPipeline)]
[string]
$Param1,
[Parameter(ValueFromPipeline)]
[int]
$Param2
)
$PSBoundParameters
}
When you try to tab complete the parameters for the function like this: "Hej" | Test -<Tab> it won't show Param2 as an available parameter even though it should be available because I'm passing in a string. This disincentivizes adding pipeline support to parameters because if the user uses the pipeline they'll get annoyed and confused at the missing parameters.
A real world example of this is a module I'm working on where I'd like to be able to do: $Driver | Install-DeviceDriver -Device XYZ or $Device | Install-DeviceDriver -Driver ABC but now I have to choose one of them.
Expected behavior
Pseudobinding takes the inferred type of the pipeline input into consideration when determining which parameters are bound. Allowing the unbound parameters to show up in tab completion.Actual behavior
Pseudobinding does not take the inferred type of the pipeline input into consideration when determining which parameters are bound. This prevents the unbound parameters from showing up in tab completion.Error details
Environment data
Name Value
---- -----
PSVersion 7.6.0-preview.5
PSEdition Core
GitCommitId 7.6.0-preview.5
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Reactions are currently unavailable
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.