The !DumpArray sos command emits invalid DML for array elements (#13855)
authortvass83 <31535082+tvass83@users.noreply.github.com>
Mon, 2 Oct 2017 13:27:48 +0000 (15:27 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Mon, 2 Oct 2017 13:27:48 +0000 (15:27 +0200)
Element Methodtable is reported correctly but for individual elements, the generated DML uses the MT of the array, not the element, thus giving incorrect results
Only value types are affected

0:007> !DumpArray /d 02b16574
Name:        WindowsFormsApplication2_SOS_bug.Test[]
MethodTable: 011c82ec
EEClass:     011c8290
Size:        412(0x19c) bytes
Array:       Rank 1, Number of elements 100, Type VALUETYPE
Element Methodtable: 011c824c
[0] 02b1657c => here is the problem

src/ToolBox/SOS/Strike/strike.cpp

index b621023d1fb507f3f6d339ec10a5a7a2ad02a2b5..6963cffe29fb87069905914e89cfa6492be48fd9 100644 (file)
@@ -1967,7 +1967,7 @@ HRESULT PrintArray(DacpObjectData& objData, DumpArrayFlags& flags, BOOL isPermSe
 
             if (isElementValueType)
             {
-                DMLOut( " %s\n", DMLValueClass(objData.MethodTable, p_Element));
+                DMLOut( " %s\n", DMLValueClass(objData.ElementTypeHandle, p_Element));
             }
             else
             {