You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update: Exception.ToString() also hits this code path and so we are leaving it in .NET 9 for futher investigation
There are a few places in the DBI that rely on CordbSafeHashTable/CHashTableAndData such as
CordbHashTableEnum
CordbProcess
CordbClass
CordbAppDomain
CordbModule
CordbFunction
The backing hash table, CHashTable, doesn't grow as items keep getting added. This results in a steep performance degradation as the collections grow larger. Common reports include difficulty loading dumps containing thousands of modules. A possible solution would be to replace CHashTable with an SHash.
Internal Microsoft team reported that they see a contention around access to DebuggerMethodInfoTable hashtable in a process that throws a lot of exceptions:
DebuggerMethodInfoTable is implemented as CHashTableAndData.
@hoyosjs part of me wants to see if we can pull this off in 10. Probably a tad too late to be aggressive. I suspect this might be able to come to some conclusion in 11.
I audited the remaining CordbSafeHashTable and CHashTableAndData users, including an independent rubber-duck review with Claude Opus 4.8.
The highest-cardinality, lower-risk right-side tables are the CordbModule class, function, and native-code caches. These are not exposed through CordbHashTableEnum, so they can move to SHash without changing COM enumeration behavior.
The remaining migrations have these dependencies:
CordbHashTableEnum stores a HASHFIND cursor and supports cloning an enumeration in progress. A replacement needs to preserve Next, Skip, Reset, and Clone. Snapshot-backed enumeration appears to be the safest option.
Cordb hash tables own internal references. Any replacement must preserve exactly-once InternalAddRef and InternalRelease behavior across insertion, removal, transfer, neutering, and destruction.
DebuggerMethodInfoTable::ClearMethodsOfModule deletes the current entry while enumerating. This relies on FindNextEntry advancing the cursor before returning the entry.
DebuggerMethodInfoTable is DAC-visible and is likely the most important remaining EE performance target, especially for exception-heavy workloads.
DebuggerPatchTable permits duplicate keys and explicitly orders matching patches by controller type within bucket chains.
DebuggerPatchTable exposes stable entry indices, directly manipulates bucket links, and publishes storage offsets for cross-process and DAC access. It should remain on its specialized representation unless those requirements are modeled explicitly.
No contractual dependence on ordinary Cordb hash-table enumeration order was found. The current implementation nevertheless exposes bucket order with newest entries first within a bucket.
The first PR will therefore migrate only the three CordbModule caches. Follow-up work should decouple CordbHashTableEnum from HASHFIND, make method-info removal explicitly iterator-safe, and define the required DAC representation before moving EE tables.
Activity
hoyosjs commentedon Oct 14, 2020
Related to #11056
jkotas commentedon Aug 10, 2023
Internal Microsoft team reported that they see a contention around access to DebuggerMethodInfoTable hashtable in a process that throws a lot of exceptions:
DebuggerMethodInfoTable is implemented as CHashTableAndData.
[-]Poorly performing hash used in the DBI[/-][+]Poorly performing hash used in the DBI/EE[/+]steveisok commentedon Jul 1, 2025
@hoyosjs part of me wants to see if we can pull this off in 10. Probably a tad too late to be aggressive. I suspect this might be able to come to some conclusion in 11.
hoyosjs commentedon Aug 13, 2026
I audited the remaining
CordbSafeHashTableandCHashTableAndDatausers, including an independent rubber-duck review with Claude Opus 4.8.The highest-cardinality, lower-risk right-side tables are the
CordbModuleclass, function, and native-code caches. These are not exposed throughCordbHashTableEnum, so they can move to SHash without changing COM enumeration behavior.The remaining migrations have these dependencies:
CordbHashTableEnumstores aHASHFINDcursor and supports cloning an enumeration in progress. A replacement needs to preserveNext,Skip,Reset, andClone. Snapshot-backed enumeration appears to be the safest option.InternalAddRefandInternalReleasebehavior across insertion, removal, transfer, neutering, and destruction.DebuggerMethodInfoTable::ClearMethodsOfModuledeletes the current entry while enumerating. This relies onFindNextEntryadvancing the cursor before returning the entry.DebuggerMethodInfoTableis DAC-visible and is likely the most important remaining EE performance target, especially for exception-heavy workloads.DebuggerPatchTablepermits duplicate keys and explicitly orders matching patches by controller type within bucket chains.DebuggerPatchTableexposes stable entry indices, directly manipulates bucket links, and publishes storage offsets for cross-process and DAC access. It should remain on its specialized representation unless those requirements are modeled explicitly.The first PR will therefore migrate only the three
CordbModulecaches. Follow-up work should decoupleCordbHashTableEnumfromHASHFIND, make method-info removal explicitly iterator-safe, and define the required DAC representation before moving EE tables.Note
This comment was generated with GitHub Copilot.