Skip to content

GetCustomAttributes fails to retrieve CmdletAttribute with ConfirmImpact property #1252

@JamesWTruher

Description

@JamesWTruher

Steps to reproduce

[System.Management.Automation.Cmdlet("Get", "Thing", ConfirmImpact = 'High', SupportsPaging = $true)]class C2{}
$t = [C2].GetCustomAttributes($false)
$t

From Scripting.Classes.Basic.Parsing.Tests.ps1

Expected behavior

NounName                : Thing
VerbName                : Get
DefaultParameterSetName :
SupportsShouldProcess   : False
SupportsPaging          : True
SupportsTransactions    : False
ConfirmImpact           : High
HelpUri                 :
RemotingCapability      : PowerShell
TypeId                  : System.Management.Automation.CmdletAttribute

Actual behavior

Exception calling "GetCustomAttributes" with "1" argument(s): "'ConfirmImpact' property specified was not found."
At line:1 char:9
+         $t = [C2].GetCustomAttributes($false)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : CustomAttributeFormatException

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.10032.0
PSEdition                      Linux
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v0.5.0-217-g9c9161febac5fc433d1987e75d8ba9b18fd286c1
CLRVersion
WSManStackVersion              1.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

Labels

Area-Maintainers-Buildspecific to affecting the buildBlockedblocked on something external to this repoIssue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions