Closed
Description
I was expecting this to throw an exception:
using System.Reflection;
internal class Program
{
private static void Main()
{
var invoker = MethodInvoker.Create(typeof(Program).GetMethod("MyMethod", BindingFlags.NonPublic | BindingFlags.Static)!);
invoker.Invoke(null);
}
static void MyMethod(int arg0, int arg1, int arg2) => Console.WriteLine($"{arg0} {arg1} {arg2}");
}
since the method has three non-optional parameters and zero arguments are being supplied, but instead it printed:
0 0 0
Is that by design?