commandlineparser / commandlineparser/commandline

System.InvalidOperationException: 'Sequence contains more than one element'

Abierto
#463 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C#
Estrellas
4.8k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.