commandlineparser / commandlineparser/commandline

Why "Zero is not allowed in range of sequence option specifications"?

Open
#722 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

I have used the old version of the CommandlineParser and it worked fine.
Now I have upgraded my console app to the latest Nuget, run the app and receive:
`System.InvalidOperationException: 'Zero is not allowed in range of sequence option specifications.'`

I have detected that option 't' is the reason of the exception.
How to fix it?

There is my definition

```
class Options
{
[Option('i', "input", Required = true, HelpText = "Input folder/file to be processed.")]
public string InputFolder { get; set; }

[Option('x', "xfiles", Required = false, HelpText = "Exclude files to be processed.")]
public IEnumerable ExcludeFiles { get; set; }

[Option('t', "types", Required = false, Min =0, Max=6,HelpText = "Exclude file extensions to be processed.")]
public IEnumerable ExcludeFileExtensions { get; set; }

[Value(0)]
public int Offset { get; set; } = 0;
}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the exception with the supplied Options class, focusing on the [Option('t', "types", Min = 0, Max = 6)] declaration and its IEnumerable property. No source file or test is named, so trace the option-validation entry point and determine what behavior or definition should be considered fixed.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.