commandlineparser / commandlineparser/commandline
System.InvalidOperationException: 'Sequence contains more than one element'
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 478
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I keep getting this Exception and I cannot figure out why.
This is my options class:
`public class BaseOptions
{
[Option(Default = false, HelpText = "Prints all verbose messages to standard output.")]
public bool Verbose { get; set; }
}
[Verb("client", HelpText = "operate as client.")]
public class ClientOptions : BaseOptions
{
[Value(0, MetaName = "dump inventory file",
Default = false,
HelpText = "set this boolean flag for dumping the inventory.")]
public bool DumpInventoryFile { get; set; }
[Value(1, MetaName = "file name",
Default = "inventory.asminventory",
HelpText = "File name for collected inventory information.")]
public string FileName { get; set; }
}`
When I start the program with a FileName, like "client true c:\Temp\server", I get the
"System.InvalidOperationException: 'Sequence contains more than one element'" in
TypeConverter.cs method "ChangeType".
If I start the program without filename, like "client true", it works as it should.
The ChangeType-method expects the parameter "IEnumerable values" to have a count of 1, but in my case it has a count of 2 ("true" and "c:\Temp\server").
Am I doing something wrong? Any help appreciated!
Regards
Bernd
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.