diff --git a/src/native/managed/cdacreader/src/Legacy/SigFormat.cs b/src/native/managed/cdacreader/src/Legacy/SigFormat.cs index 4ce7832a7bd01..8ce87039b59cd 100644 --- a/src/native/managed/cdacreader/src/Legacy/SigFormat.cs +++ b/src/native/managed/cdacreader/src/Legacy/SigFormat.cs @@ -227,9 +227,9 @@ private static unsafe void AddTypeString(Target target, case CorElementType.Var: int varIndex = signature.ReadCompressedInteger(); - if (methodInstantiation.Length > varIndex) + if (typeInstantiation.Length > varIndex) { - AddType(target, stringBuilder, methodInstantiation[varIndex]); + AddType(target, stringBuilder, typeInstantiation[varIndex]); } else { diff --git a/src/native/managed/cdacreader/src/Legacy/TypeNameBuilder.cs b/src/native/managed/cdacreader/src/Legacy/TypeNameBuilder.cs index 45e3a88b6620f..03e600e4778be 100644 --- a/src/native/managed/cdacreader/src/Legacy/TypeNameBuilder.cs +++ b/src/native/managed/cdacreader/src/Legacy/TypeNameBuilder.cs @@ -149,6 +149,12 @@ public static void AppendMethodImpl(Target target, StringBuilder stringBuilder, if (!th.IsNull) { typeInstantiationSigFormat = runtimeTypeSystem.GetInstantiation(th); + if (typeInstantiationSigFormat.IsEmpty && runtimeTypeSystem.IsArray(th, out _)) + { + // For arrays, fill in the instantiation with the element type handle + // See MethodTable::GetArrayInstantiation for coreclr equivalent + typeInstantiationSigFormat = new[] { runtimeTypeSystem.GetTypeParam(th) }; + } } SigFormat.AppendSigFormat(target, stringBuilder, signature, reader, null, null, null, typeInstantiationSigFormat, runtimeTypeSystem.GetGenericMethodInstantiation(method), true);