When I set the CustomParser property of an Argument<T> to a custom parser, and then set it back to null, the custom parser is still being used, instead of the default parser.
Code to reproduce:
#:package System.CommandLine@2.0.0
using System.CommandLine;
Argument<int> argument = new("int")
{
CustomParser = (_) =>
{
Console.WriteLine("Using Custom Parser");
return 0;
}
};
argument.CustomParser = null;
RootCommand command = new()
{
argument
};
var result = command.Parse("123");
Console.WriteLine(result.GetValue(argument));
Expected output:
Actual output: