Closed
Description
Description
The JIT throws the correct exception, but NativeAOT does not. And the if condition should use IsGenericType instead of IsConstructedGenericType to be consistent with the JIT and Mono.
like this 1e51807
Reproduction Steps
public class Test<T>
{
public void f(int a)
{
Console.WriteLine(a);
}
}
public static partial class Program
{
public static void Main(string[] args)
{
MethodBase.GetMethodFromHandle(typeof(Test<int>).GetMethod("f").MethodHandle);
}
}
Expected behavior
System.ArgumentException:“Cannot resolve method Void f(Int32) because the declaring type of the method handle PInvokeSamples.Test`1[T] is generic. Explicitly provide the declaring type to GetMethodFromHandle.”
Actual behavior
Unhandled Exception: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.ThrowHelper.ThrowFormatIndexOutOfRange() + 0x2b
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider, String, ReadOnlySpan`1) + 0x78b
at System.String.FormatHelper(IFormatProvider, String, ReadOnlySpan`1) + 0x86
at System.SR.Format(String, Object) + 0xb9
at System.Reflection.Runtime.General.ReflectionCoreCallbacksImplementation.GetMethodFromHandle(RuntimeMethodHandle) + 0xdd
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Type
Projects
Status
No status