Skip to content

MetadataError: ProgressAction was defined multiple times for the command #18976

@kborowinski

Description

@kborowinski

Prerequisites

Steps to reproduce

Invoke-Build scripts throws MetadataError: A parameter with the name 'ProgressAction' was defined multiple times for the command. on latest daily builds of PowerShell Core.

@SteveL-MSFT I believe that it's related to newly implemented ProgressAction common parameter.

The issue IS NOT occurring on PS 7.3.1 GA or PS 5.1

PS D:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.0-nightly
PSEdition                      Core
GitCommitId                    7.4.0-nightly-35-g94610307572edc7656e22bc3f5d45d57751e9f13
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS D:\> git clone https://github.com/PowerShell/PSReadLine.git PSReadLine
Cloning into 'PSReadLine'...
remote: Enumerating objects: 6143, done.
remote: Counting objects: 100% (72/72), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 6143 (delta 33), reused 58 (delta 26), pack-reused 6071
Receiving objects: 100% (6143/6143), 3.04 MiB | 25.29 MiB/s, done.
Resolving deltas: 100% (4633/4633), done.

PS D:\> cd .\PSReadLine\
PS D:\PSReadLine> Invoke-Build
MetadataError: A parameter with the name 'ProgressAction' was defined multiple times for the command.
PS D:\PSReadLine> $error[0]|fl * -force

PSMessageDetails      :
Exception             : System.Management.Automation.MetadataException: A parameter with the name 'ProgressAction' was defined multiple times for the command.
                           at System.Management.Automation.MergedCommandParameterMetadata.AddMetadataForBinder(InternalParameterMetadata parameterMetadata, ParameterBinderAssociation binderAssociation) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\MergedCommandParameterMetadata.cs:line 102
                           at System.Management.Automation.CmdletParameterBinderController.HandleCommandLineDynamicParameters(ParameterBindingException& outgoingBindingException) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 1683
                           at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 262
                           at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 108
                           at System.Management.Automation.CommandProcessor.BindCommandLineParameters() in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessor.cs:line 177
                           at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessor.cs:line 237
                           at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessorBase.cs:line 470
                           at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 996
                           at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 556
                        --- End of stack trace from previous location ---
                           at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 556
                           at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts,
                        CommandRedirection[][] commandRedirections, FunctionContext funcContext) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\runtime\Operations\MiscOps.cs:line 496
                           at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\interpreter\CallInstruction.Generated.cs:line 608
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) in
                        D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\interpreter\ControlFlowInstructions.cs:line 338
TargetObject          :
CategoryInfo          : MetadataError: (:) [], MetadataException
FullyQualifiedErrorId : ParameterNameAlreadyExistsForCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Expected behavior

PS D:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.1
PSEdition                      Core
GitCommitId                    7.3.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS D:\> cd D:\PSReadLine\
PS D:\PSReadLine> Invoke-Build
VERBOSE: Building for 'net6.0'
Build . D:\PSReadLine\PSReadLine.build.ps1
Task /./LayoutModule/BuildPolyfiller skipped.
Task /./LayoutModule/BuildMainModule
Missing output 'PSReadLine/bin/Release/net6.0/Microsoft.PowerShell.PSReadLine2.dll'.
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  Restored D:\PSReadLine\Polyfill\Polyfill.csproj (in 7.06 sec).
  Restored D:\PSReadLine\PSReadLine\PSReadLine.csproj (in 7.06 sec).
  Restored D:\PSReadLine\test\PSReadLine.Tests.csproj (in 7.24 sec).
  Restored D:\PSReadLine\MockPSConsole\MockPSConsole.csproj (in 7.74 sec).
  PSReadLine -> D:\PSReadLine\PSReadLine\bin\Release\net6.0\Microsoft.PowerShell.PSReadLine2.dll
  PSReadLine -> D:\PSReadLine\PSReadLine\bin\Release\net6.0\publish\
  MockPSConsole -> D:\PSReadLine\MockPSConsole\bin\Release\net6.0\MockPSConsole.dll
  MockPSConsole -> D:\PSReadLine\MockPSConsole\bin\Release\net6.0\publish\
  PSReadLine.Tests -> D:\PSReadLine\test\bin\Release\net6.0\PSReadLine.Tests.dll
  PSReadLine.Tests -> D:\PSReadLine\test\bin\Release\net6.0\publish\
Done /./LayoutModule/BuildMainModule 00:00:17.7238730
Task /./LayoutModule
WARNING: Build using net6.0 is not sufficient to be downlevel compatible
Task /./LayoutModule/CheckHelpContent skipped.
Done /./LayoutModule 00:00:18.3104774
Done /./RunTests/BuildMainModule
Task /./RunTests/BuildXUnitTests
Skipping up-to-date output.
Done /./RunTests/BuildXUnitTests 00:00:00.0080610
Task /./RunTests
Available layouts: en-US en-US
Testing en-US ...
Test run for D:\PSReadLine\test\bin\Release\net6.0\PSReadLine.Tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:16.79]     Test.en_US_Windows.DeadKeyShouldBeIgnored [SKIP]
  Skipped Test.en_US_Windows.DeadKeyShouldBeIgnored [1 ms]
Results File: D:\PSReadLine\test\TestResults\xUnitTestResults.en-US.xml

Passed!  - Failed:     0, Passed:   270, Skipped:     1, Total:   271, Duration: 6 s - PSReadLine.Tests.dll (net6.0)
Testing en-US ...
Test run for D:\PSReadLine\test\bin\Release\net6.0\PSReadLine.Tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:06.38]     Test.en_US_Windows.DeadKeyShouldBeIgnored [SKIP]
  Skipped Test.en_US_Windows.DeadKeyShouldBeIgnored [1 ms]
Results File: D:\PSReadLine\test\TestResults\xUnitTestResults.en-US.xml

Passed!  - Failed:     0, Passed:   270, Skipped:     1, Total:   271, Duration: 5 s - PSReadLine.Tests.dll (net6.0)
Done /./RunTests 00:00:34.0325029
Done /. 00:00:52.3480345
WARNING: /LayoutModule D:\PSReadLine\PSReadLine.build.ps1:154
Build using net6.0 is not sufficient to be downlevel compatible
Build succeeded with warnings. 5 tasks, 0 errors, 1 warnings 00:00:52.5029264

Actual behavior

PS D:\> git clone https://github.com/PowerShell/PSReadLine.git PSReadLine
Cloning into 'PSReadLine'...
remote: Enumerating objects: 6143, done.
remote: Counting objects: 100% (72/72), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 6143 (delta 33), reused 58 (delta 26), pack-reused 6071
Receiving objects: 100% (6143/6143), 3.04 MiB | 25.29 MiB/s, done.
Resolving deltas: 100% (4633/4633), done.

PS D:\> cd .\PSReadLine\
PS D:\PSReadLine> Invoke-Build
MetadataError: A parameter with the name 'ProgressAction' was defined multiple times for the command.

Error details

Exception             :
    Type        : System.Management.Automation.MetadataException
    ErrorRecord :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : A parameter with the name 'ProgressAction' was defined multiple times for the command.
            HResult : -2146233087
        CategoryInfo          : MetadataError: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : ParameterNameAlreadyExistsForCommand
        InvocationInfo        :
            ScriptLineNumber : 1
            OffsetInLine     : 1
            HistoryId        : -1
            Line             : invoke-Build
            PositionMessage  : At line:1 char:1
                               + invoke-Build
                               + ~~~~~~~~~~~~
            CommandOrigin    : Internal
        ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
    TargetSite  :
        Name          : AddMetadataForBinder
        DeclaringType : System.Management.Automation.MergedCommandParameterMetadata, System.Management.Automation, Version=7.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message     : A parameter with the name 'ProgressAction' was defined multiple times for the command.
    Data        : System.Collections.ListDictionaryInternal
    Source      : System.Management.Automation
    HResult     : -2146233087
    StackTrace  :
   at System.Management.Automation.MergedCommandParameterMetadata.AddMetadataForBinder(InternalParameterMetadata parameterMetadata, ParameterBinderAssociation binderAssociation) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\MergedCommandParameterMetadata.cs:line 102
   at System.Management.Automation.CmdletParameterBinderController.HandleCommandLineDynamicParameters(ParameterBindingException& outgoingBindingException) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 1683
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 262
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CmdletParameterBinderController.cs:line 108
   at System.Management.Automation.CommandProcessor.BindCommandLineParameters() in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessor.cs:line 177
   at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessor.cs:line 237
   at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\CommandProcessorBase.cs:line 447
   at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 1089
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 478
--- End of stack trace from previous location ---
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\pipeline.cs:line 552
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext) in D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\runtime\Operations\MiscOps.cs:line 496
   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\interpreter\CallInstruction.Generated.cs:line 608
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) in
D:\DEVELOPMENT\PowerShellCore\src\System.Management.Automation\engine\interpreter\ControlFlowInstructions.cs:line 338
CategoryInfo          : MetadataError: (:) [], MetadataException
FullyQualifiedErrorId : ParameterNameAlreadyExistsForCommand
InvocationInfo        :
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : -1
    Line             : invoke-Build
    PositionMessage  : At line:1 char:1
                       + invoke-Build
                       + ~~~~~~~~~~~~
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0-nightly
PSEdition                      Core
GitCommitId                    7.4.0-nightly-35-g94610307572edc7656e22bc3f5d45d57751e9f13
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-ExternalThe issue is caused by external component(s).WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions