Closed
Description
I hope ILCompiler dependency analysis can take generic pattern into account so that we don't need rd.xml
for this case any longer:
// Here we have System.Array.IndexOf<System.Int32>(System.Int32[],System.Int32)
var method = typeof(Array).GetTypeInfo().GetMethod(nameof(Array.IndexOf), 1, BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly, null, CallingConventions.Any, new[] { Type.MakeGenericMethodParameter(0).MakeArrayType(), Type.MakeGenericMethodParameter(0) }, null)!.MakeGenericMethod(typeof(int));
var array = new int[] { 3, 2, 1, 0 };
Console.WriteLine(method.Invoke(null, new object?[] { array, 0 }));
Current behavior without a rd.xml
:
Unhandled Exception: EETypeRva:0x00306AF8(System.Reflection.MissingRuntimeArtifactException): MakeGenericMethod() cannot create this generic method instantiation because no code was generated for it: 'System.Array.IndexOf<System.Int32>(System.Int32[],System.Int32)'.
Metadata
Metadata
Assignees
Type
Projects
Status
No status