Dump中查看dictionary信息的方法

In order to dump the contents of a dictionary, you need to start with either the MethodTable or the name of the class, then you can follow the below steps: 

0:009> !dumpheap –mt 000007feeed0b9c0

Address MT Size

000000018003e630 000007feeed0b9c0 80

000000018008ec10 000007feeed0b9c0 80

Statistics:

MT Count TotalSize Class Name

000007feeed0b9c0 2 160 System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters, Microsoft.TeamFoundation.Framework.Server]]

Total 2 objects

Note: You can also use -Dumpheap -type System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters,Microsoft.TeamFoundation.Framework.Server]]

0:009> !do 000000018003e630

Name: System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters, Microsoft.TeamFoundation.Framework.Server]]

MethodTable: 000007feeed0b9c0

EEClass: 000007fef6368220

Size: 80(0x50) 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

000007fef69516e8 4000c5a 8 System.Int32[] 0 instance 000000018003ea90 buckets

000007fef74448a8 4000c5b 10 …non, mscorlib]][] 0 instance 000000018003eac8 entries

000007fef6951748 4000c5c 38 System.Int32 1 instance 7 count

000007fef6951748 4000c5d 3c System.Int32 1 instance 7 version

000007fef6951748 4000c5e 40 System.Int32 1 instance -1 freeList

000007fef6951748 4000c5f 44 System.Int32 1 instance 0 freeCount

000007fef698f1a8 4000c60 18 ….Guid, mscorlib]] 0 instance 000000038000dc90 comparer

000007fef74bfd40 4000c61 20 …Canon, mscorlib]] 0 instance 0000000000000000 keys

000007fef74bd380 4000c62 28 …Canon, mscorlib]] 0 instance 000000018206b690 values

000007fef694ef78 4000c63 30 System.Object 0 instance 0000000000000000 _syncRoot

0:009> !da 000000018003eac8

Name: System.Collections.Generic.Dictionary`2+Entry[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters, Microsoft.TeamFoundation.Framework.Server]][]

MethodTable: 000007fe984b5918

EEClass: 000007fe984b5870

Size: 248(0xf8) bytes

Array: Rank 1, Number of elements 7, Type VALUETYPE

Element Methodtable: 000007fe984b57d8

[0] 000000018003ead8

[1] 000000018003eaf8

[2] 000000018003eb18

[3] 000000018003eb38

[4] 000000018003eb58

[5] 000000018003eb78

[6] 000000018003eb98

0:009> !dumpvc 000007fe984b57d8 000000018003ead8

Name: System.Collections.Generic.Dictionary`2+Entry[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters, Microsoft.TeamFoundation.Framework.Server]]

MethodTable: 000007fe984b57d8

EEClass: 000007fef6368348

Size: 48(0x30) 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

000007fef6951748 4000c68 8 System.Int32 1 instance 1348927451 hashCode

000007fef6951748 4000c69 c System.Int32 1 instance -1 next

000007fef69497e0 4000c6a 10 System.Guid 1 instance 000000018003eae8 key

000007fef6953be8 4000c6b 0 System.__Canon 0 instance 000000018003e890 value

0:009> !do 000000018003e890

Name: Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters

MethodTable: 000007feef604a38

EEClass: 000007feeed727e8

Size: 64(0x40) bytes

File: C:\Program Files\Microsoft Team Foundation Server 12.0\Application Tier\TfsJobAgent\Microsoft.TeamFoundation.Framework.Server.dll

Fields:

MT Field Offset Type VT Attr Value Name

000007fef6955a00 4000ec4 8 ….ReaderWriterLock 0 instance 000000018003e8d0 m_serializationObject

000007fef694e998 4000ec5 10 System.String 0 instance 0000000000000000 m_counterCategoryName

000007fef4c6e4d0 4000ec6 18 …ounterSetInstance 0 instance 0000000000000000 m_defaultCounterSetInstance

000007feeecb7a58 4000ec7 20 …ramework.Server]] 0 instance 0000000000000000 m_counterSetInstances

000007fef4c6e430 4000ec8 28 …ceData.CounterSet 0 instance 0000000000000000 m_counterSet

000007fef6932398 4000ec9 30 System.Object[] 0 instance 0000000000000000 m_counters

posted @   凌晨三点半  阅读(1156)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示