Skip to content

name collision behavior is inconsistent for commands, directives, and options added to the same parent #2223

Closed

Description

@jonsequitur

Currently, certain naming collisions between symbols under a common parent command will result in a parser configuration whose behavior might not be correct during parsing (e.g. one symbol will always shadow the other) or might throw an exception during parsing.

  • Commands and directives having the same name will throw System.ArgumentException: An item with the same key has already been added. even though this will not result in a misbehaving parser, since at parse time the actual directive tokens are differentiated from commands by the presence of surround [ and ] brackets. (Related: UseHost() - can't have subcommand "config" #2220)
    • A command with brackets in its name ("[command]") could be shadowed by a directive named command.
  • Commands and options with matching names or aliases will not currently result in an exception during parsing.

Activity

  1. added
    bug
    on Jun 15, 2023
  2. added this to the 2.0 GA milestone on Jun 15, 2023
  3. jeffhandley commented on Sep 18, 2025

    @jeffhandley
    Member

    We don't think this is an issue anymore.

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

    Area-APIbug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions