Skip to content

CommandInvocationIntrinsics.InvokeScript bind arguments to $input instead of $args #4923

@PetSerAl

Description

@PetSerAl

This lines:

public Collection<PSObject> InvokeScript(string script, params object[] args)
{
    return InvokeScript(script, true, PipelineResultTypes.None, args);
}

Pass args parameter into input parameter of called function, thus mixing them up.

Steps to reproduce

$ExecutionContext.SessionState.InvokeCommand.InvokeScript('"`$args:($args); `$input:($input)"', 1, 2, 3)

Expected behavior

$args:(1 2 3); $input:()

Actual behavior

$args:(); $input:(1 2 3)

Environment data

Tested in v2.0 and v5.1.15063.608

Metadata

Metadata

Assignees

Labels

Breaking-Changebreaking change that may affect usersIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions