Skip to content

Bug - Format-Default - Cannot process argument because the value of argument "name" is not valid #21147

@BernieWhite

Description

@BernieWhite

Prerequisites

Steps to reproduce

The issue is specific to TableControl with that pulls from a localized resource.

Expected behavior

This starts failing from PS 7.4.


<View>
      <Name>PSRule.Rules.RuleRecord</Name>
      <ViewSelectedBy>
        <TypeName>PSRule.Rules.RuleRecord</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <PropertyName>TargetName</PropertyName>
      </GroupBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label AssemblyName="Microsoft.PSRule.Core" BaseName="PSRule.Resources.ViewStrings" ResourceId="RuleName"/>
            <Width>35</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label AssemblyName="Microsoft.PSRule.Core" BaseName="PSRule.Resources.ViewStrings" ResourceId="Outcome"/>
            <Width>10</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label AssemblyName="Microsoft.PSRule.Core" BaseName="PSRule.Resources.ViewStrings" ResourceId="Recommendation"/>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>RuleName</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Outcome</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Recommendation</PropertyName>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>

Actual behavior

Generates exception.

Error details

Type           : System.Management.Automation.CmdletInvocationException
ErrorRecord    :
    Exception             :
        Type        : System.Management.Automation.PSArgumentException
        ErrorRecord :
            Exception             :
                Type    : System.Management.Automation.ParentContainsErrorRecordException
                Message : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
                HResult : -2146233087
            CategoryInfo          : InvalidArgument: (:) [], ParentContainsErrorRecordException
            FullyQualifiedErrorId : Argument
        Message     : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
        ParamName   : name
        TargetSite  :
            Name          : get_Item
            DeclaringType : System.Management.Automation.PSMemberInfoIntegratingCollection`1[T]
            MemberType    : Method
            Module        : System.Management.Automation.dll
        Source      : System.Management.Automation
        HResult     : -2147024809
        StackTrace  :
   at System.Management.Automation.PSMemberInfoIntegratingCollection`1.get_Item(String name)
   at Microsoft.PowerShell.Commands.Internal.Format.TableViewGenerator.GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.TableViewGenerator.GenerateStartData(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.InnerFormatShapeCommand.WriteFormatStartData(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.InnerFormatShapeCommand.ProcessObject(PSObject so)
   at System.Management.Automation.CommandProcessor.ProcessRecord()
    CategoryInfo          : InvalidArgument: (:) [format-default], PSArgumentException
    FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.FormatDefaultCommand
    InvocationInfo        :
        MyCommand       : format-default
        HistoryId       : 3
        CommandOrigin   : Internal
    ScriptStackTrace      : at Invoke-PSRule<Process>, D:\Dev\Workspace\PSRule\out\modules\PSRule\PSRule.psm1: line 181
                            at <ScriptBlock>, <No file>: line 1
    PipelineIterationInfo :



TargetSite     :
    Name          : Invoke
    DeclaringType : System.Management.Automation.Runspaces.PipelineBase, System.Management.Automation, Version=7.4.1.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    MemberType    : Method
    Module        : System.Management.Automation.dll
Message        : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
InnerException :
    Type        : System.Management.Automation.PSArgumentException
    ErrorRecord :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
            HResult : -2146233087
        CategoryInfo          : InvalidArgument: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : Argument
    Message     : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
    ParamName   : name
    TargetSite  :
        Name          : get_Item
        DeclaringType : System.Management.Automation.PSMemberInfoIntegratingCollection`1[T]
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Source      : System.Management.Automation
    HResult     : -2147024809
    StackTrace  :
   at System.Management.Automation.PSMemberInfoIntegratingCollection`1.get_Item(String name)
   at Microsoft.PowerShell.Commands.Internal.Format.TableViewGenerator.GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.TableViewGenerator.GenerateStartData(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.InnerFormatShapeCommand.WriteFormatStartData(PSObject so)
   at Microsoft.PowerShell.Commands.Internal.Format.InnerFormatShapeCommand.ProcessObject(PSObject so)
   at System.Management.Automation.CommandProcessor.ProcessRecord()
Source         : System.Management.Automation
HResult        : -2146233087
StackTrace     :
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
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

Metadata

Metadata

Assignees

Labels

In-PRIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the product

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions