Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using a dynamicparam block in an advanced function causes invocations with the -PipelineVariable common parameter to fail #6420

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

An (adapted) copy of this uservoice issue first reported by @PetSerAl in 2014:

Using a dynamicparam block in an advanced function causes invocations with the -PipelineVariable common parameter to fail.

Steps to reproduce

function foo {
  [CmdletBinding()]
  param()
  dynamicparam { }
  process { 'hi' }
}

foo -PipelineVariable bar

Expected behavior

hi

Actual behavior

The following error is reported:

foo : Cannot retrieve the dynamic parameters for the cmdlet. Object reference not set to an instance of an object.
...

Note that it doesn't make a difference whether the dynamicparam block is empty or not.

Environment data

PowerShell Core v6.0.2 on macOS 10.13.3
PowerShell Core v6.0.2 on Ubuntu 16.04.3 LTS
PowerShell Core v6.0.2 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.674 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.