commandlineparser / commandlineparser/commandline

Not meaningful error in case of options with same name

Open
#872 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

Repro:
```csharp
class Options {
[Option('s', "storage", Required = true, HelpText = "Storage account name hosting metrics")]
public string StorageName { get; set; }

[Option('s', "key", Required = true, HelpText = "Key of given storage account")]
public string StorageKey { get; set; }
}
```

Error given is:
`System.InvalidOperationException: 'Sequence contains more than one matching element`

Suggested message:
`One of more options has the same name. Check attributes properties`

Thanks :)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the C# Options example with duplicate short names and trace where the InvalidOperationException is produced. Check the existing error-handling tests or entry point for option validation, then add coverage showing that duplicate option names produce a meaningful diagnostic like the suggested message.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.