Commit 41bb922
Handle minimal MethodTables in dotnet-pgo trace processing (#127818)
BulkType ETW events emit `TypeNameID = th.GetCl()`
(eventtrace_bulktype.cpp). For "minimal" MethodTables created by
`CreateMinimalMethodTable` (used for Reflection.Emit DynamicMethod hosts
in dynamicmethod.cpp and the IL stub cache in ilstubcache.cpp), `SetCl`
is never called, so `GetCl` returns `mdTypeDefNil` (0x02000000, rid 0).
dotnet-pgo previously treated this as a valid TypeDef token, and the
lazy `EcmaType.Name` access would throw `BadImageFormatException: Read
out of bounds` because rid 0 is before the typedef table.
Validate the typedef row before constructing the `TypeDefinitionHandle`
and treat out-of-range rids (rid 0, or rid greater than the typedef
table size) as unresolvable dynamic types so trace processing can
continue.
This started failing on the SDK training pipeline after #126330 (Migrate
CLR to COM stubs to be IL stubs) and #125352 (Move struct marshaling to
transient IL) flowed through, which routed new categories of stubs
through the minimal-MT path and added their BulkType events to the
trace.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 30359c8 commit 41bb922
1 file changed
Lines changed: 12 additions & 1 deletion
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
409 | 420 | | |
410 | 421 | | |
411 | 422 | | |
| |||
0 commit comments