commandlineparser / commandlineparser/commandline

Example with Option with IEnumerable<string> broken - Sequence contains more than one element

Aperta
#377 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
good first issue
Lingua principale
C#
Stelle
4.8k
Fork
478
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.