Skip to content

ScriptBlock.Invoke* code path has limited InvocationInfo #20500

Closed

Description

Prerequisites

Steps to reproduce

Any scriptblock invoked via any of the *Invoke* code paths that lead to InvokeWithPipe end up creating a limited InvocationInfo (most notably missing CommandInfo).

{ $MyInvocation }.Invoke()

Expected behavior

MyCommand             :  $MyInvocation
BoundParameters       : {}
UnboundArguments      : {}
ScriptLineNumber      : 0
OffsetInLine          : 0
HistoryId             : 1
ScriptName            :
Line                  : { $MyInvocation }.Invoke()
Statement             : { $MyInvocation }.Invoke()
PositionMessage       : At line:1 char:1
                        + { $MyInvocation }.Invoke()
                        + ~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot          :
PositionMessage       :
PSScriptRoot          :
PSCommandPath         :
InvocationName        :
PipelineLength        : 0
PipelinePosition      : 0
ExpectingInput        : False
CommandOrigin         : Internal
DisplayScriptPosition :

Actual behavior

MyCommand             :
BoundParameters       : {}
UnboundArguments      : {}
ScriptLineNumber      : 1
OffsetInLine          : 1
HistoryId             : 1
ScriptName            :
Line                  : { $MyInvocation }.Invoke()
Statement             : { $MyInvocation }.Invoke()
PositionMessage       : At line:1 char:1
                        + { $MyInvocation }.Invoke()
                        + ~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot          :
PSCommandPath         :
InvocationName        :
PipelineLength        : 0
PipelinePosition      : 0
ExpectingInput        : False
CommandOrigin         : Internal
DisplayScriptPosition :

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.6
PSEdition                      Core
GitCommitId                    7.4.0-preview.6
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    Issue-Enhancementthe issue is more of a feature request than a bug
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Oct 16, 2023
  2. microsoft-github-policy-service commented on Apr 14, 2024

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

    Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions