Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Improve generic virtual method resolution FailFast message
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky authored and jkotas committed Oct 24, 2018
1 parent 7951582 commit adefdef
Showing 1 changed file with 14 additions and 13 deletions.
Expand Up @@ -44,18 +44,7 @@ private string GetTypeNameDebug(RuntimeTypeHandle rtth)
return qTypeDefinition.NativeFormatHandle.GetFullName(qTypeDefinition.NativeFormatReader);
}

result = "EEType:0x";
ulong num = (ulong)RuntimeAugments.GetPointerFromTypeHandle(rtth);

int shift = IntPtr.Size * 8;
const string HexDigits = "0123456789ABCDEF";
while (shift > 0)
{
shift -= 4;
int digit = (int)((num >> shift) & 0xF);
result += HexDigits[digit];
}
return result;
return rtth.LowLevelToStringRawEETypeAddress();
}
#endif

Expand Down Expand Up @@ -522,7 +511,19 @@ private unsafe bool ResolveGenericVirtualMethodTarget_Static(RuntimeTypeHandle t

if (!TryGetGenericVirtualMethodPointer(targetTypeHandle, targetMethodNameAndSignature, genericArguments, out methodPointer, out dictionaryPointer))
{
Environment.FailFast("GVM method pointer lookup failure");
var sb = new System.Text.StringBuilder();
sb.AppendLine("Generic virtual method pointer lookup failure.");
sb.AppendLine();
sb.AppendLine("Declaring type handle: " + declaringType.LowLevelToStringRawEETypeAddress());
sb.AppendLine("Target type handle: " + targetTypeHandle.LowLevelToStringRawEETypeAddress());
sb.AppendLine("Method name: " + targetMethodNameAndSignature.Name);
sb.AppendLine("Instantiation:");
for (int i = 0; i < genericArguments.Length; i++)
{
sb.AppendLine(" Argument " + i.LowLevelToString() + ": " + genericArguments[i].LowLevelToStringRawEETypeAddress());
}

Environment.FailFast(sb.ToString());
}

return true;
Expand Down

0 comments on commit adefdef

Please sign in to comment.