Skip to content

Commit

Permalink
[cdac] Fix building of method signature names for class type variables (
Browse files Browse the repository at this point in the history
#106654)

- Use type instantiation (instead of method) for formatting signature with class type variables
- Handle creating instantiation for arrays to pass to signature formatting helper
  • Loading branch information
elinor-fung authored Aug 19, 2024
1 parent 10720d2 commit cc76011
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/native/managed/cdacreader/src/Legacy/SigFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 6 additions & 0 deletions src/native/managed/cdacreader/src/Legacy/TypeNameBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cc76011

Please sign in to comment.