commandlineparser / commandlineparser/commandline

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

オープン
#463 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
4.8k
フォーク
478
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。