commandlineparser / commandlineparser/commandline
Example with Option with IEnumerable<string> broken - Sequence contains more than one element
- 主要语言
- C#
- 星标
- 4.8k
- 派生
- 478
- PR 合并指标
- 30 天内没有已合并 PR
描述
Running the latest commandlineparser v2.3.0 on .Net Core 2.1.
The library example doesn't seem to work at all parsing IEnumerable
[Option('r', "read", Required = true, HelpText = "Input files to be processed.")]
public IEnumerable InputFiles { get; set; }
If you specify --read file1 file2 you get this exception:
System.InvalidOperationException
HResult=0x80131509
Message=Sequence contains more than one element
Source=System.Linq
StackTrace:
> System.Linq.dll!System.Linq.Enumerable.Single(System.Collections.Generic.IEnumerable source) Line 45 C#
CommandLine.dll!CommandLine.Core.InstanceBuilder.Build.AnonymousMethod__0_23(CommandLine.Core.SpecificationProperty sp) Unknown
CommandLine.dll!CommandLine.Core.ReflectionExtensions.SetProperties.AnonymousMethod__0(System.__Canon current, CommandLine.Core.SpecificationProperty specProp) Unknown
System.Linq.dll!System.Linq.Enumerable.Aggregate(System.Collections.Generic.IEnumerable source, LogMerger.Program.Options seed, System.Func func) Line 55 C#
CommandLine.dll!CommandLine.Core.InstanceBuilder.Build.AnonymousMethod__16() Unknown
CommandLine.dll!CommandLine.Core.InstanceBuilder.Build.AnonymousMethod__7() Unknown
CommandLine.dll!CommandLine.Parser.ParseArguments(System.Collections.Generic.IEnumerable args) Unknown
贡献指南
这个仓库没有索引到贡献指南
调研方向
在 .NET Core 2.1 上使用所示的 IEnumerable 选项和两个 --read 值重现该故障。从堆栈跟踪中出现的 CommandLine.Core.InstanceBuilder.Build 和 ReflectionExtensions.SetProperties 开始。完成标准是:对包含多个输入文件的示例进行解析时,不再出现 Sequence contains more than one element 异常,并且解析能够完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100