Fix assertion failure in ILDasm with -METADATA=RAW flag#122876
Merged
AaronRobinsonMSFT merged 3 commits intomainfrom Jan 5, 2026
Merged
Fix assertion failure in ILDasm with -METADATA=RAW flag#122876AaronRobinsonMSFT merged 3 commits intomainfrom
AaronRobinsonMSFT merged 3 commits intomainfrom
Conversation
Co-authored-by: AaronRobinsonMSFT <[email protected]>
Contributor
There was a problem hiding this comment.
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" |
Copilot
AI
changed the title
[WIP] Fix assert when passing -METADATA=RAW to ILDasm
Fix assertion failure in ILDasm with -METADATA=RAW flag
Jan 5, 2026
Member
|
@jkoritzinsky Looks like we missed updating ILDasm when adding |
AaronRobinsonMSFT
approved these changes
Jan 5, 2026
jkoritzinsky
approved these changes
Jan 5, 2026
This was referenced Jan 5, 2026
Member
|
/ba-g Unrelated |
This was referenced Jan 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.