Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@ivberg-zz

Description

@ivberg-zz
Issue body actions

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.Type>(System.Collections.Generic.IEnumerable<System.Type> 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<CommandLine.Core.SpecificationProperty, LogMerger.Program.Options>(System.Collections.Generic.IEnumerable<CommandLine.Core.SpecificationProperty> source, LogMerger.Program.Options seed, System.Func<LogMerger.Program.Options, CommandLine.Core.SpecificationProperty, LogMerger.Program.Options> 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<LogMerger.Program.Options>(System.Collections.Generic.IEnumerable args) Unknown

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.