Skip to content

DumpArray uses wrong method table when dumping arrays of structs #3532

@davkean

Description

@davkean

Description

  1. Download this dump and open in WinDBG.
  2. .load C:\Users\[user]\.dotnet\sos\sos.dll
  3. !DumpArray /d 000001d92fa85d98
Name:        System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Int32, mscorlib]][]
MethodTable: 00007ff8c5e07818
EEClass:     00007ff8c5f463e8
Size:        96(0x60) bytes
Array:       Rank 1, Number of elements 3, Type VALUETYPE
Element Methodtable: 00007ff8c5e077b8
[0] 000001d92fa85da8  <!-- Click this
[1] 000001d92fa85dc0
[2] 000001d92fa85dd8
  1. Click the first element

Expected:

Passes the method table from the element to /DumpVC:

0:000> !DumpVC /d 00007ff8c5e077b8 000001d92fa85da8
Name:        System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Int32, mscorlib]]
MethodTable: 00007ff8c5e077b8
EEClass:     00007ff8c5fe9e48
Size:        40(0x28) bytes
File:        C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007ff8c5e332c0  40034f6        8         System.Int32  1 instance       1820105034 hashCode
00007ff8c5e332c0  40034f7        c         System.Int32  1 instance               -1 next
00007ff8c5e34f38  40034f8        0       System.__Canon  0 instance 000001d92fa82e30 key
00007ff8c5e332c0  40034f9       10         System.Int32  1 instance                1 value

Actual:

Passes the method table from the array to /DumpVC:

0:000> !DumpVC /d 00007ff8c5e07818 000001d92fa85da8
Name:        System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Int32, mscorlib]][]
MethodTable: 00007ff8c5e07818
EEClass:     00007ff8c5f463e8
Size:        24(0x18) bytes
File:        C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
Fields:

Configuration

This seems specific to .NET Framework, because the same repro but compiled against .NET Core correctly picks the right method table (Why is that?)
Version of sos: 6.0.351802

Regression?

No.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions