-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix assertion failure in ILDasm with -METADATA=RAW flag #122876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assertion failure in ILDasm with -METADATA=RAW flag #122876
Conversation
Co-authored-by: AaronRobinsonMSFT <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an assertion failure that occurs when running ILDasm with the -METADATA=RAW flag. The root cause was a size mismatch between the g_szMapElementType and g_szMapUndecorateType arrays (which had 34 elements) and the expected size ELEMENT_TYPE_MAX (which is 0x23 or 35 decimal). The missing element was ELEMENT_TYPE_CMOD_INTERNAL at index 0x22.
Key changes:
- Added
ELEMENT_TYPE_CMOD_INTERNALentry to both mapping arrays in mdinfo.cpp to match the complete CorElementType enum - Modified assertion format in pal_assert.h to reorder filename and line number display
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/tools/metainfo/mdinfo.cpp | Adds missing "CMOD_INTERNAL" entry at index 0x22 to both g_szMapElementType and g_szMapUndecorateType arrays, fixing the array size to match ELEMENT_TYPE_MAX (35 elements) |
| src/coreclr/pal/inc/pal_assert.h | Reorders __FILE__ and __LINE__ parameters in assertion output format from "line %d in %s" to "%s:%d" |
|
@jkoritzinsky Looks like we missed updating ILDasm when adding |
|
/ba-g Unrelated |
Description
ILDasm crashes with assertion failure when invoked with
-METADATA=RAW:The
g_szMapElementTypeandg_szMapUndecorateTypearrays had 34 elements butELEMENT_TYPE_MAXis 0x23 (35). Missing entry:ELEMENT_TYPE_CMOD_INTERNALat index 0x22.Added
"CMOD_INTERNAL"to both arrays inmdinfo.cpp.Customer Impact
ILDasm with
-METADATA=RAWflag fails immediately on any assembly. Blocks metadata inspection workflows.Regression
Yes.
ELEMENT_TYPE_CMOD_INTERNALwas added tocorhdr.hbut corresponding array entries were not updated.Testing
-METADATA=RAWcompletes without assertion on test assemblyRisk
Low. Two-line fix adds missing array element to match enum definition. No logic changes.
Original prompt
-METADATA=RAWto ILDasm. #122875💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.