As used in HostingExtensions.UseCommandHandler<THandler>(this CliCommand command):
|
public static CliCommand UseCommandHandler<THandler>(this CliCommand command) |
|
where THandler : CliAction |
|
{ |
|
command.Action = CommandHandler.Create(typeof(THandler).GetMethod(nameof(CliAction.InvokeAsync))); |
|
|
|
return command; |
|
} |
This seems incompatible with explicit override supported by Visual Basic, i.e. where THandler has a method that overrides CliAction.InvokeAsync but is not itself named InvokeAsync.
Besides, GetMethod will fail due to ambiguity if THandler has multiple public methods named InvokeAsync, which is possible in C# too.
Originally posted by @KalleOlaviNiemitalo in #2205 (comment)
As used in HostingExtensions.UseCommandHandler<THandler>(this CliCommand command):
command-line-api/src/System.CommandLine.Hosting/HostingExtensions.cs
Lines 54 to 60 in b40ebf6
This seems incompatible with explicit override supported by Visual Basic, i.e. where THandler has a method that overrides CliAction.InvokeAsync but is not itself named InvokeAsync.
Besides, GetMethod will fail due to ambiguity if THandler has multiple public methods named InvokeAsync, which is possible in C# too.
Originally posted by @KalleOlaviNiemitalo in #2205 (comment)