Fix FieldDesc::GetExactFieldType when FieldDesc doesn't exactly represent the owner...
authorIgor Kulaychuk <igor.kulaychuk@gmail.com>
Mon, 22 May 2017 16:30:40 +0000 (19:30 +0300)
committerJan Kotas <jkotas@microsoft.com>
Mon, 22 May 2017 16:30:40 +0000 (09:30 -0700)
* Fix FieldDesc::GetExactFieldType when FieldDesc doesn't exactly represent the owner type

To get the exact type from FieldDesc, field signature should point past the calling convention.

src/vm/field.cpp

index 9cdb16f..667e2ac 100644 (file)
@@ -888,12 +888,15 @@ TypeHandle FieldDesc::GetExactFieldType(TypeHandle owner)
         GetSig(&pSig, &cSig);
         SigPointer sig(pSig, cSig);
 
+        ULONG callConv;
+        IfFailThrow(sig.GetCallingConv(&callConv));
+        _ASSERTE(callConv == IMAGE_CEE_CS_CALLCONV_FIELD);
+
         // Get the generics information
         SigTypeContext sigTypeContext(GetExactClassInstantiation(owner), Instantiation());
 
-        TypeHandle thApproxFieldType = GetApproxFieldTypeHandleThrowing();
         // Load the exact type
-        RETURN (sig.GetTypeHandleThrowing(thApproxFieldType.GetModule(), &sigTypeContext));
+        RETURN (sig.GetTypeHandleThrowing(GetModule(), &sigTypeContext));
     }
 }