Skip to content

Commit

Permalink
Fix stringification of types in managed type system (#80036)
Browse files Browse the repository at this point in the history
This part was deleted too enthusiastically. We still need it. I don't know what I was thinking.
  • Loading branch information
MichalStrehovsky authored Dec 29, 2022
1 parent 1d15f21 commit 96b849e
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,17 @@ public static string LowLevelToString(this IntPtr arg)
public static string LowLevelToString(this RuntimeTypeHandle rtth)
{
TypeReferenceHandle typeRefHandle;
QTypeDefinition qTypeDefinition;
MetadataReader reader;

// Try to get the name from metadata
if (TypeLoaderEnvironment.Instance.TryGetMetadataForNamedType(rtth, out qTypeDefinition))
{
reader = qTypeDefinition.NativeFormatReader;
TypeDefinitionHandle typeDefHandle = qTypeDefinition.NativeFormatHandle;
return typeDefHandle.GetFullName(reader);
}

// Try to get the name from diagnostic metadata
if (TypeLoaderEnvironment.TryGetTypeReferenceForNamedType(rtth, out reader, out typeRefHandle))
{
Expand Down

0 comments on commit 96b849e

Please sign in to comment.