You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot use more than 8 options on one command #1878
varstringOption=newOption<string?>(name:"--test",description:"Test Option",getDefaultValue:()=>null);varcmd=newCommand("testcommand","This has 7 arguments");cmd.SetHandler(async(a,b,c,d,e,f,g,h)=>{},stringOption,stringOption,stringOption,stringOption,stringOption,stringOption,stringOption,stringOption);
while this won't.
varstringOption=newOption<string?>(name:"--test",description:"Test Option",getDefaultValue:()=>null);varcmd=newCommand("testcommand","Tests more than 7 arguments, this example has 8");cmd.SetHandler(async(a,b,c,d,e,f,g,h,i)=>{},stringOption,stringOption,stringOption,stringOption,stringOption,stringOption,stringOption,stringOption,stringOption);
All I did change here was add one more parameter. According to the docs, there should be overloads for up to 16 parameters.
Any ideas what is going on?
Edit
Looking into the Handler.Func.cs source file (partial class), there are actually only implementations up to 8 generic parameters. Unfortunately, the AnonymousCommandHandler class used in the methods is internal, so it cannot easily be extended.
Finally, we've reduced the number of SetHandler overloads. Where before there were overloads supporting up to sixteen generic parameters, they now only go up to eight.
I don't know why the API documentation still hasn't been updated.
Activity
KalleOlaviNiemitalo commentedon Oct 20, 2022
The change was announced in #1750 (comment):
I don't know why the API documentation still hasn't been updated.
elgonzo commentedon Oct 20, 2022
FYI: The general documentation / usage guide for System.CommandLine mentions both 16 parameters and 8 parameters for handlers on the same page: