commandlineparser / commandlineparser/commandline
System.InvalidOperationException: 'Sequence contains more than one element'
- Lingua principale
- C#
- Stelle
- 4.8k
- Fork
- 478
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.