Description
The most common issue people encounter with the System.CommandLine API is when option or argument names/aliases do not match the parameters in a command handler:
var command= new RootCommand
{
new Option<int>("--aaa")
};
command.Handler = CommandHandler.Create<int>(zzz => /* zzz is always going to be 0 */);
We haven't seen an approach that enforces a relationship between the parameters and the parser at compile time without an enormous increase in the complexity of the code, so we took a more dynamic approach, based on ASP.NET MVC controller methods. The consequence is that these mismatches can't be flagged by the compiler, and until 57C5 you're aware of the convention, it's easy to get this wrong.
Programmatic validation that all parameters are matchable on all command handlers at runtime has been proposed. This approach would be very expensive, especially when complex objects rather than scalar values are being bound, and since this won't vary after the code is compiled, it's not ideal to pay this cost every time a program runs.
An analyzer might be a more appropriate tool for the job, since it only needs to be validated when the code is being written. It could also include quick fixes for renaming parameters to match options and arguments.