commandlineparser / commandlineparser/commandline

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

未關閉
#722 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

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;
}

```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

使用提供的 Options 類別重現例外,重點關注 [Option('t', "types", Min = 0, Max = 6)] 宣告及其 IEnumerable 屬性。未指定原始檔案或測試,因此請追蹤選項驗證進入點,並判斷哪種行為或定義應視為已修正。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。