Closed
Description
When I try this code, the command handler gets no value for the first argument and thus causes an assertion exception:
private static int Main(string[] args)
{
var inputOption = new Option<string>(
new string[] { "--input", "-i" }, "first");
var testCommand = new Command("test", "test summary")
{
inputOption
};
testCommand.Handler = CommandHandler.Create<string>(f
=> Debug.Assert(!string.IsNullOrWhiteSpace(f)));
var rootCommand = new RootCommand()
{
testCommand
};
return rootCommand.InvokeAsync(args).Result;
}
args: test -i 1
If I change only the alias names when creating an Option to this:
var inputOption = new Option<string>(
new string[] { "--fnput", "-f" }, "first");
It works fine
args: test -f 1
Am I missing something obvious?
Version: 2.0.0-beta1.21308.1