question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parameter with both ValueFromPipelineByPropertyName and PSDefaultParameterValue "cannot be bound"

See original GitHub issue

Steps to reproduce

repro.ps1

function Get-DebugInputParams {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName)]
        [string]
        $MyParam = "myCmdletDefaultValue" #Note, even without the default value this scenario still fails
    )
    Begin {
        Write-Output "Begin:   MyInputWhichSometimesHasDefaultParameterValue is $MyParam"
        $PSBoundParameters
    }

    Process {
        Write-Output "Process: MyInputWhichSometimesHasDefaultParameterValue is $MyParam"
        $PSBoundParameters
    }

    End {
        Write-Output "End:     MyInputWhichSometimesHasDefaultParameterValue is $MyParam"
        $PSBoundParameters
    }
}

$myObject = [PSCustomObject]@{
    MyParam     = 'MyValueFromCustomObject'
}

$PSDefaultParameterValues.Remove("Get-DebugInputParams:MyParam")
Write-Output "================== Command by itself, no default parameter values ======================"
Get-DebugInputParams

Write-Output "================== Command piped, no default parameter values  ======================"
$myObject | Get-DebugInputParams

$global:PSDefaultParameterValues["Get-DebugInputParams:MyParam"] = "MyDefaultParameterValue"


Write-Output "================== Command by itself with default parameter values ======================"
Get-DebugInputParams

Write-Output "================== Command piped with default parameter values ======================"
$myObject | Get-DebugInputParams

Write-Output "================== Tracing failed output ======================"
Trace-Command -Expression {$myObject | Get-DebugInputParams } -Name *ParameterBind* -PSHost
. .\repro.ps1

Expected behavior

$global:PSDefaultParameterValues["Get-DebugInputParams:MyParam"] = "MyDefaultParameterValue"
$myObject | Get-DebugInputParams
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue

Key     Value
---     -----
MyParam MyDefaultParameterValue 
Process: MyInputWhichSometimesHasDefaultParameterValue is MyValueFromCustomObject

Key     Value
---     -----
MyParam MyValueFromCustomObject
End:     MyInputWhichSometimesHasDefaultParameterValue is MyValueFromCustomObject
MyParam MyValueFromCustomObject

Actual behavior

$global:PSDefaultParameterValues["Get-DebugInputParams:MyParam"] = "MyDefaultParameterValue"
$myObject | Get-DebugInputParams
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue

Key     Value
---     -----
MyParam MyDefaultParameterValue
Get-DebugInputParams: The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
Full output from sourcing script then running tracing
. .\repro.ps1
$global:PSDefaultParameterValues["Get-DebugInputParams:MyParam"] = "MyDefaultParameterValue"
Trace-Command -Expression {$myObject | Get-DebugInputParams } -Name *ParameterBind* -PSHost
DEBUG: 2021-02-03 12:07:21.0562 ParameterBinderController Information: 0 :  WriteLine   Argument count: 0
DEBUG: 2021-02-03 12:07:21.0577 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.0587 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.0592 ParameterBinding Information: 0 : BIND DEFAULT <parameter, value> pairs after [POSITIONAL BIND] for [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.0596 ParameterBinding Information: 0 :     BIND arg [MyDefaultParameterValue] to parameter [MyParam]
DEBUG: 2021-02-03 12:07:21.0600 ParameterBinding Information: 0 :         Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:07:21.0605 ParameterBinding Information: 0 :             result returned from DATA GENERATION: MyDefaultParameterValue
DEBUG: 2021-02-03 12:07:21.0609 ParameterBinding Information: 0 :         COERCE arg to [System.String]
DEBUG: 2021-02-03 12:07:21.0613 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:07:21.0617 ParameterBinding Information: 0 :         BIND arg [MyDefaultParameterValue] to param [MyParam] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.0621 ParameterBinderController Information: 0 :  WriteLine   BIND DEFAULT after [POSITIONAL BIND] result [True]
DEBUG: 2021-02-03 12:07:21.0625 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.0630 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.0634 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.0638 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.0643 ParameterBinderController Information: 0 :  WriteLine       Argument count: 1
DEBUG: 2021-02-03 12:07:21.0653 ParameterBinding Information: 0 :     BIND NAMED cmd line args [Write-Output]
DEBUG: 2021-02-03 12:07:21.0660 ParameterBinding Information: 0 :     BIND POSITIONAL cmd line args [Write-Output]
DEBUG: 2021-02-03 12:07:21.0668 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.0676 ParameterBinding Information: 0 :     BIND REMAININGARGUMENTS cmd line args to param: [InputObject]
DEBUG: 2021-02-03 12:07:21.0684 ParameterBinding Information: 0 :         BIND arg [System.Collections.Generic.List`1[System.Object]] to parameter [InputObject]
DEBUG: 2021-02-03 12:07:21.0691 ParameterBinding Information: 0 :             COERCE arg to [System.Management.Automation.PSObject]
DEBUG: 2021-02-03 12:07:21.0702 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Collections.Generic.List`1[System.Object] to System.Management.Automation.PSObject
DEBUG: 2021-02-03 12:07:21.0710 ParameterBinding Information: 0 :                 The parameter is of type [System.Management.Automation.PSObject] and the argument is an PSObject, so the parameter value is the argument value wrapped into an PSObject.
DEBUG: 2021-02-03 12:07:21.0758 ParameterBinding Information: 0 :             BIND arg [Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.0842 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.0863 ParameterBinding Information: 0 :     MANDATORY PARAMETER CHECK on cmdlet [Write-Output]
DEBUG: 2021-02-03 12:07:21.0898 ParameterBinding Information: 0 :     CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.0913 ParameterBinding Information: 0 :     CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.1004 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.1020 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.PSCustomObject]
DEBUG: 2021-02-03 12:07:21.1029 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:07:21.1055 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.1164 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.1181 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.1214 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.1222 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.1418 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-Default]
DEBUG: 2021-02-03 12:07:21.1467 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:07:21.1559 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:07:21.1673 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:07:21.1797 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:07:21.1821 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:07:21.1939 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.1956 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:07:21.2135 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.2192 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.2284 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.2312 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.2330 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.2340 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-Default]
DEBUG: 2021-02-03 12:07:21.2375 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:07:21.2456 ParameterBinding Information: 0 : BIND NAMED cmd line args [Out-LineOutput]
DEBUG: 2021-02-03 12:07:21.2472 ParameterBinding Information: 0 :     BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to parameter [LineOutput]
DEBUG: 2021-02-03 12:07:21.2480 ParameterBinding Information: 0 :         COERCE arg to [System.Object]
DEBUG: 2021-02-03 12:07:21.2488 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:07:21.2503 ParameterBinding Information: 0 :         BIND arg [Microsoft.PowerShell.Commands.Internal.Format.ConsoleLineOutput] to param [LineOutput] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.2511 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Out-LineOutput]
DEBUG: 2021-02-03 12:07:21.2523 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.2535 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.2543 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-LineOutput]
DEBUG: 2021-02-03 12:07:21.2551 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.2559 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-LineOutput]
DEBUG: 2021-02-03 12:07:21.2602 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:07:21.2705 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:07:21.2721 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:07:21.2755 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:07:21.2843 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:07:21.2860 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.2873 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:07:21.2901 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.2913 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.2997 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.3014 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.3023 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.3035 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [out-lineoutput]
DEBUG: 2021-02-03 12:07:21.3064 ParameterBinderController Information: 0 :  WriteLine   Argument count: 0
DEBUG: 2021-02-03 12:07:21.3166 ParameterBinding Information: 0 : BIND NAMED cmd line args [Format-Default]
DEBUG: 2021-02-03 12:07:21.3183 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Format-Default]
DEBUG: 2021-02-03 12:07:21.3192 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.3219 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.3334 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Format-Default]
DEBUG: 2021-02-03 12:07:21.3372 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.3386 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Format-Default]
DEBUG: 2021-02-03 12:07:21.3493 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:07:21.3515 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:07:21.3545 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:07:21.3554 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:07:21.3564 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:07:21.3603 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.3613 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:07:21.3714 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.3759 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.3772 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.3951 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:07:21.4003 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:21.4105 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [format-default]
DEBUG: 2021-02-03 12:07:21.4291 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:07:21.4309 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:07:21.4432 ParameterBinding Information: 0 :     BIND arg [True] to parameter [Off]
DEBUG: 2021-02-03 12:07:21.4448 ParameterBinding Information: 0 :         COERCE arg to [System.Management.Automation.SwitchParameter]
DEBUG: 2021-02-03 12:07:21.4556 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:07:21.4574 ParameterBinding Information: 0 :         BIND arg [True] to param [Off] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.4611 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:07:21.4719 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Off
DEBUG: 2021-02-03 12:07:21.4765 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Off
DEBUG: 2021-02-03 12:07:21.4779 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2021-02-03 12:07:21.4958 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.5028 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.5153 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:07:21.5245 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.5262 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.5349 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:07:21.5386 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:07:21.5492 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:07:21.5509 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:07:21.5522 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:07:21.5534 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.5542 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.5550 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:07:21.5557 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:07:21.5566 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:07:21.5576 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:07:21.5611 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.5711 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:07:21.5728 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.5765 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.5871 ParameterBinding Information: 0 : BIND arg [Red] to parameter [color]
DEBUG: 2021-02-03 12:07:21.5884 ParameterBinding Information: 0 :     Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:07:21.5911 ParameterBinding Information: 0 :         result returned from DATA GENERATION: Red
DEBUG: 2021-02-03 12:07:21.6013 ParameterBinding Information: 0 :     BIND arg [Red] to param [color] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.6035 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:07:21.6045 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.6077 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.6234 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:07:21.6253 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:07:21.6341 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:07:21.6382 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:07:21.6396 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:07:21.6523 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.6611 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.6742 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:07:21.6784 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:07:21.6891 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:07:21.6921 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:07:21.7023 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.7125 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:07:21.7141 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.7175 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.7264 ParameterBinding Information: 0 : BIND arg [Cyan] to parameter [color]
DEBUG: 2021-02-03 12:07:21.7282 ParameterBinding Information: 0 :     Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:07:21.7293 ParameterBinding Information: 0 :         result returned from DATA GENERATION: Cyan
DEBUG: 2021-02-03 12:07:21.7301 ParameterBinding Information: 0 :     BIND arg [Cyan] to param [color] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.7333 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:07:21.7425 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.7440 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:07:21.7449 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:07:21.7457 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:07:21.7465 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:07:21.7473 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:07:21.7480 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:07:21.7489 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.7499 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.7512 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:07:21.7522 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:07:21.7534 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:07:21.7544 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:07:21.7552 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:07:21.7560 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:07:21.7570 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.7580 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.7718 ParameterBinderController Information: 0 :  WriteLine   Argument count: 4
DEBUG: 2021-02-03 12:07:21.7738 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-Command]
DEBUG: 2021-02-03 12:07:21.7777 ParameterBinding Information: 0 :     BIND arg [Get-DebugInputParams] to parameter [Name]
DEBUG: 2021-02-03 12:07:21.7882 ParameterBinding Information: 0 :         COERCE arg to [System.String[]]
DEBUG: 2021-02-03 12:07:21.7928 ParameterBinding Information: 0 :             Trying to convert argument value from System.Management.Automation.FunctionInfo to System.String[]
DEBUG: 2021-02-03 12:07:21.7936 ParameterBinding Information: 0 :             ENCODING arg into collection
DEBUG: 2021-02-03 12:07:21.8046 ParameterBinding Information: 0 :             Binding collection parameter Name: argument type [FunctionInfo], parameter type [System.String[]], collection type Array, element type [System.String], coerceElementType
DEBUG: 2021-02-03 12:07:21.8083 ParameterBinding Information: 0 :             Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:07:21.8193 ParameterBinding Information: 0 :             Argument type FunctionInfo is not IList, treating this as scalar
DEBUG: 2021-02-03 12:07:21.8325 ParameterBinding Information: 0 :             COERCE arg to [System.String]
DEBUG: 2021-02-03 12:07:21.8445 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Management.Automation.FunctionInfo to System.String
DEBUG: 2021-02-03 12:07:21.8478 ParameterBinding Information: 0 :                 CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-02-03 12:07:21.8563 ParameterBinding Information: 0 :                 CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Get-DebugInputParams]
DEBUG: 2021-02-03 12:07:21.8581 ParameterBinding Information: 0 :             Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:07:21.8613 ParameterBinding Information: 0 :         Executing VALIDATION metadata: [System.Management.Automation.ValidateNotNullOrEmptyAttribute]
DEBUG: 2021-02-03 12:07:21.8721 ParameterBinderBase Information: 0 :  WriteLine               Validation attribute on Name returned False.
DEBUG: 2021-02-03 12:07:21.8739 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Name] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.8776 ParameterBinding Information: 0 :     BIND arg [Ignore] to parameter [ErrorAction]
DEBUG: 2021-02-03 12:07:21.8882 ParameterBinding Information: 0 :         COERCE arg to [System.Management.Automation.ActionPreference]
DEBUG: 2021-02-03 12:07:21.8898 ParameterBinding Information: 0 :             Trying to convert argument value from System.String to System.Management.Automation.ActionPreference
DEBUG: 2021-02-03 12:07:21.8934 ParameterBinding Information: 0 :             CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-02-03 12:07:21.9041 ParameterBinding Information: 0 :             CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Ignore]
DEBUG: 2021-02-03 12:07:21.9138 ParameterBinding Information: 0 :         BIND arg [Ignore] to param [ErrorAction] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.9231 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-Command]
DEBUG: 2021-02-03 12:07:21.9255 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = AllCommandSet
DEBUG: 2021-02-03 12:07:21.9345 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = AllCommandSet
DEBUG: 2021-02-03 12:07:21.9363 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-Command]
DEBUG: 2021-02-03 12:07:21.9401 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:21.9510 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:21.9542 ParameterBinderController Information: 0 :  WriteLine   Argument count: 2
DEBUG: 2021-02-03 12:07:21.9557 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:07:21.9567 ParameterBinding Information: 0 :     BIND arg [1] to parameter [Version]
DEBUG: 2021-02-03 12:07:21.9578 ParameterBinding Information: 0 :         Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: 2021-02-03 12:07:21.9624 ParameterBinding Information: 0 :             result returned from DATA GENERATION: 1.0
DEBUG: 2021-02-03 12:07:21.9630 ParameterBinding Information: 0 :         COERCE arg to [System.Version]
DEBUG: 2021-02-03 12:07:21.9740 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:07:21.9784 ParameterBinding Information: 0 :         Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: 2021-02-03 12:07:21.9872 ParameterBinderBase Information: 0 :  WriteLine               Validation attribute on Version returned False.
DEBUG: 2021-02-03 12:07:21.9889 ParameterBinding Information: 0 :         BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: 2021-02-03 12:07:21.9898 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:07:21.9936 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Version
DEBUG: 2021-02-03 12:07:21.9945 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Version
DEBUG: 2021-02-03 12:07:22.0051 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2021-02-03 12:07:22.0084 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:22.0203 ParameterBinding Information: 0 : CALLING EndProcessing
Get-DebugInputParams: The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:07:22.0438 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:07:22.0467 ParameterBinderController Information: 0 :  WriteLine       Argument count: 1
DEBUG: 2021-02-03 12:07:22.0562 ParameterBinding Information: 0 :     BIND NAMED cmd line args [Write-Output]
DEBUG: 2021-02-03 12:07:22.0579 ParameterBinding Information: 0 :     BIND POSITIONAL cmd line args [Write-Output]
DEBUG: 2021-02-03 12:07:22.0678 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:22.0693 ParameterBinding Information: 0 :     BIND REMAININGARGUMENTS cmd line args to param: [InputObject]
DEBUG: 2021-02-03 12:07:22.0707 ParameterBinding Information: 0 :         BIND arg [System.Collections.Generic.List`1[System.Object]] to parameter [InputObject]
DEBUG: 2021-02-03 12:07:22.0715 ParameterBinding Information: 0 :             COERCE arg to [System.Management.Automation.PSObject]
DEBUG: 2021-02-03 12:07:22.0746 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Collections.Generic.List`1[System.Object] to System.Management.Automation.PSObject
DEBUG: 2021-02-03 12:07:22.0843 ParameterBinding Information: 0 :                 The parameter is of type [System.Management.Automation.PSObject] and the argument is an PSObject, so the parameter value is the argument value wrapped into an PSObject.
DEBUG: 2021-02-03 12:07:22.0860 ParameterBinding Information: 0 :             BIND arg [End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:07:22.0892 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:07:22.0903 ParameterBinding Information: 0 :     MANDATORY PARAMETER CHECK on cmdlet [Write-Output]
DEBUG: 2021-02-03 12:07:22.1012 ParameterBinding Information: 0 :     CALLING BeginProcessing
DEBUG: 2021-02-03 12:07:22.1035 ParameterBinding Information: 0 :     CALLING EndProcessing
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue

Key     Value
---     -----
MyParam MyDefaultParameterValue
End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue


Full output from running script
. .\myScript.ps1
================== Command by itself, no default parameter values ======================
Begin:   MyInputWhichSometimesHasDefaultParameterValue is myCmdletDefaultValue
Process: MyInputWhichSometimesHasDefaultParameterValue is myCmdletDefaultValue
End:     MyInputWhichSometimesHasDefaultParameterValue is myCmdletDefaultValue
================== Command piped, no default parameter values  ======================
Begin:   MyInputWhichSometimesHasDefaultParameterValue is myCmdletDefaultValue
Process: MyInputWhichSometimesHasDefaultParameterValue is MyValueFromCustomObject

DEBUG: 2021-02-03 12:06:01.5391 ParameterBinderController Information: 0 :  WriteLine   Argument count: 0
DEBUG: 2021-02-03 12:06:01.5410 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:01.5423 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:01.5432 ParameterBinding Information: 0 : BIND DEFAULT <parameter, value> pairs after [POSITIONAL BIND] for [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:01.5440 ParameterBinding Information: 0 :     BIND arg [MyDefaultParameterValue] to parameter [MyParam]
DEBUG: 2021-02-03 12:06:01.5448 ParameterBinding Information: 0 :         Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:06:01.5459 ParameterBinding Information: 0 :             result returned from DATA GENERATION: MyDefaultParameterValue
DEBUG: 2021-02-03 12:06:01.5490 ParameterBinding Information: 0 :         COERCE arg to [System.String]
DEBUG: 2021-02-03 12:06:01.5499 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:06:01.5713 ParameterBinding Information: 0 :         BIND arg [MyDefaultParameterValue] to param [MyParam] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.5868 ParameterBinderController Information: 0 :  WriteLine   BIND DEFAULT after [POSITIONAL BIND] result [True]
DEBUG: 2021-02-03 12:06:01.5908 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.5934 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.5949 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:01.5958 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:01.5967 ParameterBinderController Information: 0 :  WriteLine       Argument count: 1
DEBUG: 2021-02-03 12:06:01.5975 ParameterBinding Information: 0 :     BIND NAMED cmd line args [Write-Output]
DEBUG: 2021-02-03 12:06:01.5982 ParameterBinding Information: 0 :     BIND POSITIONAL cmd line args [Write-Output]
DEBUG: 2021-02-03 12:06:01.5990 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.5998 ParameterBinding Information: 0 :     BIND REMAININGARGUMENTS cmd line args to param: [InputObject]
DEBUG: 2021-02-03 12:06:01.6032 ParameterBinding Information: 0 :         BIND arg [System.Collections.Generic.List`1[System.Object]] to parameter [InputObject]
DEBUG: 2021-02-03 12:06:01.6122 ParameterBinding Information: 0 :             COERCE arg to [System.Management.Automation.PSObject]
DEBUG: 2021-02-03 12:06:01.6139 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Collections.Generic.List`1[System.Object] to System.Management.Automation.PSObject
DEBUG: 2021-02-03 12:06:01.6148 ParameterBinding Information: 0 :                 The parameter is of type [System.Management.Automation.PSObject] and the argument is an PSObject, so the parameter value is the argument value wrapped into an PSObject.
DEBUG: 2021-02-03 12:06:01.6156 ParameterBinding Information: 0 :             BIND arg [Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.6185 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.6287 ParameterBinding Information: 0 :     MANDATORY PARAMETER CHECK on cmdlet [Write-Output]
DEBUG: 2021-02-03 12:06:01.6305 ParameterBinding Information: 0 :     CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:01.6333 ParameterBinding Information: 0 :     CALLING EndProcessing
DEBUG: 2021-02-03 12:06:01.6342 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:01.6452 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.PSCustomObject]
DEBUG: 2021-02-03 12:06:01.6485 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:06:01.6500 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.6624 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.6750 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.6885 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.6902 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.6991 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-Default]
DEBUG: 2021-02-03 12:06:01.7027 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:06:01.7044 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:06:01.7133 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:06:01.7149 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:06:01.7158 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:06:01.7187 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.7294 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:06:01.7313 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.7342 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.7355 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.7527 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.7577 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.7667 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-Default]
DEBUG: 2021-02-03 12:06:01.7690 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-LineOutput]
DEBUG: 2021-02-03 12:06:01.7807 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:06:01.7825 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:06:01.7932 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:06:01.7955 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:06:01.7966 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:06:01.7974 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.7982 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:06:01.7989 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.7997 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8004 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8064 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8156 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.8211 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [out-lineoutput]
DEBUG: 2021-02-03 12:06:01.8360 ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Format-Default]
DEBUG: 2021-02-03 12:06:01.8472 ParameterBinding Information: 0 :     PIPELINE object TYPE = [System.Management.Automation.ErrorRecord]
DEBUG: 2021-02-03 12:06:01.8507 ParameterBinding Information: 0 :     RESTORING pipeline parameter's original values
DEBUG: 2021-02-03 12:06:01.8616 ParameterBinding Information: 0 :     Parameter [InputObject] PIPELINE INPUT ValueFromPipeline NO COERCION
DEBUG: 2021-02-03 12:06:01.8657 ParameterBinderController Information: 0 :  WriteLine       Adding PipelineParameter name=InputObject; value=The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
DEBUG: 2021-02-03 12:06:01.8674 ParameterBinding Information: 0 :     BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to parameter [InputObject]
DEBUG: 2021-02-03 12:06:01.8784 ParameterBinding Information: 0 :         BIND arg [The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.8828 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = True
DEBUG: 2021-02-03 12:06:01.8936 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.8959 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8976 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8986 ParameterBinderController Information: 0 :  WriteLine       aParameterWasBound = False
DEBUG: 2021-02-03 12:06:01.8999 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:01.9008 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [format-default]
DEBUG: 2021-02-03 12:06:01.9060 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:06:01.9130 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:06:01.9150 ParameterBinding Information: 0 :     BIND arg [True] to parameter [Off]
DEBUG: 2021-02-03 12:06:01.9162 ParameterBinding Information: 0 :         COERCE arg to [System.Management.Automation.SwitchParameter]
DEBUG: 2021-02-03 12:06:01.9193 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:06:01.9208 ParameterBinding Information: 0 :         BIND arg [True] to param [Off] SUCCESSFUL
DEBUG: 2021-02-03 12:06:01.9309 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:06:01.9418 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Off
DEBUG: 2021-02-03 12:06:01.9532 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Off
DEBUG: 2021-02-03 12:06:01.9563 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2021-02-03 12:06:01.9676 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:01.9714 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:01.9884 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:06:01.9906 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.0000 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.0047 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:06:02.0063 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:06:02.0212 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:06:02.0242 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:06:02.0403 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:06:02.0541 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.0614 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.0749 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:06:02.0918 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:06:02.1079 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:06:02.1104 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:06:02.1221 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.1237 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:06:02.1326 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.1363 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:02.1508 ParameterBinding Information: 0 : BIND arg [Red] to parameter [color]
DEBUG: 2021-02-03 12:06:02.1540 ParameterBinding Information: 0 :     Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:06:02.1633 ParameterBinding Information: 0 :         result returned from DATA GENERATION: Red
DEBUG: 2021-02-03 12:06:02.1668 ParameterBinding Information: 0 :     BIND arg [Red] to param [color] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.1779 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:06:02.1817 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.1831 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.1939 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:06:02.1959 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:06:02.1976 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:06:02.1986 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:06:02.1994 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:06:02.2001 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.2009 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.2056 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:06:02.2067 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:06:02.2252 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:06:02.2284 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:06:02.2544 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.2595 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:06:02.2677 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.2714 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:02.2826 ParameterBinding Information: 0 : BIND arg [Cyan] to parameter [color]
DEBUG: 2021-02-03 12:06:02.2839 ParameterBinding Information: 0 :     Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: 2021-02-03 12:06:02.2950 ParameterBinding Information: 0 :         result returned from DATA GENERATION: Cyan
DEBUG: 2021-02-03 12:06:02.2974 ParameterBinding Information: 0 :     BIND arg [Cyan] to param [color] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.2983 ParameterBinderController Information: 0 :  WriteLine   Argument count: 1
DEBUG: 2021-02-03 12:06:02.2991 ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.2999 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Path]
DEBUG: 2021-02-03 12:06:02.3007 ParameterBinding Information: 0 :     BIND arg [env:__SuppressAnsiEscapeSequences] to parameter [Path]
DEBUG: 2021-02-03 12:06:02.3020 ParameterBinding Information: 0 :         Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, element type [System.String], no coerceElementType
DEBUG: 2021-02-03 12:06:02.3068 ParameterBinding Information: 0 :         Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:06:02.3222 ParameterBinding Information: 0 :         Argument type String is not IList, treating this as scalar
DEBUG: 2021-02-03 12:06:02.3237 ParameterBinding Information: 0 :         Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:06:02.3328 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Path] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.3379 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.3469 ParameterBinding Information: 0 : BIND cmd line args to DYNAMIC parameters.
DEBUG: 2021-02-03 12:06:02.3485 ParameterBinderController Information: 0 :  WriteLine       The Cmdlet supports the dynamic parameter interface
DEBUG: 2021-02-03 12:06:02.3511 ParameterBinderController Information: 0 :  WriteLine       Getting the bindable object from the Cmdlet
DEBUG: 2021-02-03 12:06:02.3624 ParameterBinderController Information: 0 :  WriteLine       No dynamic parameter object was returned from the Cmdlet
DEBUG: 2021-02-03 12:06:02.3641 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Path
DEBUG: 2021-02-03 12:06:02.3670 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Path]
DEBUG: 2021-02-03 12:06:02.3781 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.3802 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:02.3840 ParameterBinding Information: 0 : BIND arg [     | ] to parameter [string]
DEBUG: 2021-02-03 12:06:02.3940 ParameterBinding Information: 0 :     COERCE arg to [System.Object]
DEBUG: 2021-02-03 12:06:02.3963 ParameterBinding Information: 0 :         Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:06:02.3974 ParameterBinding Information: 0 :     BIND arg [     | ] to param [string] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.3985 ParameterBinderController Information: 0 :  WriteLine   Argument count: 4
DEBUG: 2021-02-03 12:06:02.3994 ParameterBinding Information: 0 : BIND NAMED cmd line args [Get-Command]
DEBUG: 2021-02-03 12:06:02.4001 ParameterBinding Information: 0 :     BIND arg [Get-DebugInputParams] to parameter [Name]
DEBUG: 2021-02-03 12:06:02.4009 ParameterBinding Information: 0 :         COERCE arg to [System.String[]]
DEBUG: 2021-02-03 12:06:02.4021 ParameterBinding Information: 0 :             Trying to convert argument value from System.Management.Automation.FunctionInfo to System.String[]
DEBUG: 2021-02-03 12:06:02.4054 ParameterBinding Information: 0 :             ENCODING arg into collection
DEBUG: 2021-02-03 12:06:02.4157 ParameterBinding Information: 0 :             Binding collection parameter Name: argument type [FunctionInfo], parameter type [System.String[]], collection type Array, element type [System.String], coerceElementType
DEBUG: 2021-02-03 12:06:02.4302 ParameterBinding Information: 0 :             Creating array with element type [System.String] and 1 elements
DEBUG: 2021-02-03 12:06:02.4388 ParameterBinding Information: 0 :             Argument type FunctionInfo is not IList, treating this as scalar
DEBUG: 2021-02-03 12:06:02.4414 ParameterBinding Information: 0 :             COERCE arg to [System.String]
DEBUG: 2021-02-03 12:06:02.4428 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Management.Automation.FunctionInfo to System.String
DEBUG: 2021-02-03 12:06:02.4437 ParameterBinding Information: 0 :                 CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-02-03 12:06:02.4445 ParameterBinding Information: 0 :                 CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Get-DebugInputParams]
DEBUG: 2021-02-03 12:06:02.4454 ParameterBinding Information: 0 :             Adding scalar element of type String to array position 0
DEBUG: 2021-02-03 12:06:02.4467 ParameterBinding Information: 0 :         Executing VALIDATION metadata: [System.Management.Automation.ValidateNotNullOrEmptyAttribute]
DEBUG: 2021-02-03 12:06:02.4474 ParameterBinderBase Information: 0 :  WriteLine               Validation attribute on Name returned False.
DEBUG: 2021-02-03 12:06:02.4482 ParameterBinding Information: 0 :         BIND arg [System.String[]] to param [Name] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.4490 ParameterBinding Information: 0 :     BIND arg [Ignore] to parameter [ErrorAction]
DEBUG: 2021-02-03 12:06:02.4525 ParameterBinding Information: 0 :         COERCE arg to [System.Management.Automation.ActionPreference]
DEBUG: 2021-02-03 12:06:02.4687 ParameterBinding Information: 0 :             Trying to convert argument value from System.String to System.Management.Automation.ActionPreference
DEBUG: 2021-02-03 12:06:02.4708 ParameterBinding Information: 0 :             CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: 2021-02-03 12:06:02.4870 ParameterBinding Information: 0 :             CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [Ignore]
DEBUG: 2021-02-03 12:06:02.4922 ParameterBinding Information: 0 :         BIND arg [Ignore] to param [ErrorAction] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.4999 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Get-Command]
DEBUG: 2021-02-03 12:06:02.5022 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = AllCommandSet
DEBUG: 2021-02-03 12:06:02.5064 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = AllCommandSet
DEBUG: 2021-02-03 12:06:02.5169 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Get-Command]
DEBUG: 2021-02-03 12:06:02.5427 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.5543 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:02.5562 ParameterBinderController Information: 0 :  WriteLine   Argument count: 2
DEBUG: 2021-02-03 12:06:02.5585 ParameterBinding Information: 0 : BIND NAMED cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:06:02.5593 ParameterBinding Information: 0 :     BIND arg [1] to parameter [Version]
DEBUG: 2021-02-03 12:06:02.5606 ParameterBinding Information: 0 :         Executing DATA GENERATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ArgumentToVersionTransformationAttribute]
DEBUG: 2021-02-03 12:06:02.5616 ParameterBinding Information: 0 :             result returned from DATA GENERATION: 1.0
DEBUG: 2021-02-03 12:06:02.5624 ParameterBinding Information: 0 :         COERCE arg to [System.Version]
DEBUG: 2021-02-03 12:06:02.5641 ParameterBinding Information: 0 :             Parameter and arg types the same, no coercion is needed.
DEBUG: 2021-02-03 12:06:02.5648 ParameterBinding Information: 0 :         Executing VALIDATION metadata: [Microsoft.PowerShell.Commands.SetStrictModeCommand+ValidateVersionAttribute]
DEBUG: 2021-02-03 12:06:02.5678 ParameterBinderBase Information: 0 :  WriteLine               Validation attribute on Version returned False.
DEBUG: 2021-02-03 12:06:02.5696 ParameterBinding Information: 0 :         BIND arg [1.0] to param [Version] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.5798 ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Set-StrictMode]
DEBUG: 2021-02-03 12:06:02.5832 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Version
DEBUG: 2021-02-03 12:06:02.5955 ParameterBinderController Information: 0 :  WriteLine   CurrentParameterSetName = Version
DEBUG: 2021-02-03 12:06:02.6005 ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Set-StrictMode]
DEBUG: 2021-02-03 12:06:02.6226 ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.6244 ParameterBinding Information: 0 : CALLING EndProcessing
Key     Value
---     -----
MyParam MyValueFromCustomObject
End:     MyInputWhichSometimesHasDefaultParameterValue is MyValueFromCustomObject
MyParam MyValueFromCustomObject
================== Command by itself with default parameter values ======================
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
Process: MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
================== Command piped with default parameter values ======================
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
Get-DebugInputParams: C:\gbs\PowershellBugDefaultParameterRepro\myScript.ps1:44
Line |
  44 |  $myObject | Get-DebugInputParams
     |              ~~~~~~~~~~~~~~~~~~~~
     | The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
================== Tracing failed output ======================
Get-DebugInputParams: C:\gbs\PowershellBugDefaultParameterRepro\myScript.ps1:47
Line |
  47 |  Trace-Command -Expression {$myObject | Get-DebugInputParams } -Name * …
     |                                         ~~~~~~~~~~~~~~~~~~~~
     | The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

DEBUG: 2021-02-03 12:06:02.7070 ParameterBinding Information: 0 : CALLING EndProcessing
DEBUG: 2021-02-03 12:06:02.7079 ParameterBinderController Information: 0 :  WriteLine       Argument count: 1
DEBUG: 2021-02-03 12:06:02.7194 ParameterBinding Information: 0 :     BIND NAMED cmd line args [Write-Output]
DEBUG: 2021-02-03 12:06:02.7247 ParameterBinding Information: 0 :     BIND POSITIONAL cmd line args [Write-Output]
DEBUG: 2021-02-03 12:06:02.7300 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:02.7337 ParameterBinding Information: 0 :     BIND REMAININGARGUMENTS cmd line args to param: [InputObject]
DEBUG: 2021-02-03 12:06:02.7364 ParameterBinding Information: 0 :         BIND arg [System.Collections.Generic.List`1[System.Object]] to parameter [InputObject]
DEBUG: 2021-02-03 12:06:02.7379 ParameterBinding Information: 0 :             COERCE arg to [System.Management.Automation.PSObject]
DEBUG: 2021-02-03 12:06:02.7386 ParameterBinding Information: 0 :                 Trying to convert argument value from System.Collections.Generic.List`1[System.Object] to System.Management.Automation.PSObject
DEBUG: 2021-02-03 12:06:02.7394 ParameterBinding Information: 0 :                 The parameter is of type [System.Management.Automation.PSObject] and the argument is an PSObject, so the parameter value is the argument value wrapped into an PSObject.
DEBUG: 2021-02-03 12:06:02.7421 ParameterBinding Information: 0 :             BIND arg [End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue] to param [InputObject] SUCCESSFUL
DEBUG: 2021-02-03 12:06:02.7430 ParameterBinderController Information: 0 :  WriteLine       CurrentParameterSetName = __AllParameterSets
DEBUG: 2021-02-03 12:06:02.7526 ParameterBinding Information: 0 :     MANDATORY PARAMETER CHECK on cmdlet [Write-Output]
DEBUG: 2021-02-03 12:06:02.7546 ParameterBinding Information: 0 :     CALLING BeginProcessing
DEBUG: 2021-02-03 12:06:02.7573 ParameterBinding Information: 0 :     CALLING EndProcessing
Begin:   MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue
End:     MyInputWhichSometimesHasDefaultParameterValue is MyDefaultParameterValue
MyParam MyDefaultParameterValue

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.4
PSEdition                      Core
GitCommitId                    7.0.4
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daxian-dbwcommented, Feb 5, 2021

I believe it was by design. Having $PSDefaultParameters kick in before Pipeline Parameter binding means that $PSDefaultParameters will influence the pipeline parameter binding – different parameter set may be chosen depending on what’s defined in $PSDefaultParameters and hence different parameters may be bound for objects coming from pipeline. It’s not supposed to work like the Default Arguments that are specified in a function declaration.

The the docs on ValueFromPipelineByPropertyName mentions the following, but I agree it’s a bit vague and can be improved. Please feel free to open an issue in https://github.com/MicrosoftDocs/PowerShell-Docs.

Cmdlets and advanced functions use the custom default value unless you specify another value in the command.

As for the error message, I agree it can be improved to be more clear. /cc @rjmholt @JamesWTruher any thoughts?

1reaction
daxian-dbwcommented, Feb 3, 2021

Arguments from $PSDefaultParameters get bound before pipeline parameter binding, and unlike the default argument that you specify within a function declaration, they are real parameter bindings essentially similar to a named parameter (e.g. -Path mypath). Therefore, after an entry from $PSDefaultParameters gets bound, the particular parameter is taken can cannot be bound anymore.

Given that, I think the reported behavior is by design. @JamesWTruher @rjmholt, any different thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does pipeline parameter cause error when combined ...
A parameter that is bound via an entry in the dictionary stored in the $PSDefaultParameterValues preference variable is bound before it is ...
Read more >
ValueFromPipelineByPropertyNa...
I have defined a cmdlet with two parametersets. Each paramset allows parameters to be passed from the pipeline by the propertyName.
Read more >
Why is implementing "head" so difficult? : r/PowerShell
Let's try giving the function a parameter, and let's add CmdletBinding() to make the function a command. PS> function head { [CmdletBinding()] ...
Read more >
Parameter binding pipeline input, and how the default ...
Sometimes you want to do specific things based on the parameter set that is bound, and if it is not bound/known because there...
Read more >
Parameter binding in the PowerShell pipeline
The pipeline prepares two lists of unbound pipeline parameters, one called ValueFromPipeline and a second called ValueFromPipelineByPropertyName ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found