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.
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix WinMD handling in System.Reflection.MetadataLoadContext #58344
Fix WinMD handling in System.Reflection.MetadataLoadContext #58344
Changes from 1 commit
d0806d6
114f43d
66463ea
ccb94df
7698e90
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is this necessary (was there an issue converting from token to row number) or just simplification?
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.
Yeah, it's at least half of the fix.
System.Reflection
handles WinMDs fine, because it knows about virtualAssemblyRefs
.System.Reflection.MetadataLoadContext
didn't. I dropped the wrong/incompleteGetTokenRowNumber
impl fromSystem.Reflection.MetadataLoadContext
, and used the correctSystem.Reflection
one.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.
I assume you mean
System.Reflection.Metadata
, notSystem.Reflection
via the reader optionMetadataReaderOptions.ApplyWindowsRuntimeProjections
and the resultingMetadataKind.WindowsMetadata
enum value.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.
style\nit: for a simple two-case switch I think an
if
statement is more appropriate.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.
Was there is an attempt in tests to use an actual
.winmd
file, as in the original issue?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.
This is a reduced copy that still exhibits the issue. The only snag was having to use ILASM from .NET Framework instead of .NET one, which silently generated
.winmd
with wrong metadata version, which is a crucial thing for reproducing the issue. The original.winmd
files (Windows SDK UnionMetadata one, and the ones from Windows installation folder) are too big to put in a test.