Metadata ordering issues
See original GitHub issueSome of the metadata tables have requirements on sort order. ILPack doesn’t currently ensure these rules aren’t violated. The main two that seem to be causing issues is the order of the generic parameters table and the interface map.
These are difficult to reproduce in the unit tests because the ordering and interleaving of things can be affected by other things in the project. Here’s how to reproduce both issues in Sandbox.
Add the following to SandboxSubject\MyClass.cs, just below MyClass:
public class GPOrder1
{
public void Function1<T>()
{
}
public void Function2<T>()
{
}
}
public class GPOrder2<T>
{
}
Result:
Metadata table GenericParam not sorted.
at System.Reflection.Throw.InvalidOperation_TableNotSorted(TableIndex tableIndex)
at System.Reflection.Metadata.Ecma335.MetadataBuilder.ValidateGenericParamTable()
at System.Reflection.Metadata.Ecma335.MetadataBuilder.ValidateOrder()
at System.Reflection.Metadata.Ecma335.MetadataRootBuilder.Serialize(BlobBuilder builder, Int32 methodBodyStreamRva, Int32 mappedFieldDataStreamRva)
For the interface map problem, remove the above code and add this instead:
interface Itf1
{
}
interface Itf2
{
}
class MyImpl : Itf2, Itf1
{
}
Result:
Metadata table InterfaceImpl not sorted.
at System.Reflection.Throw.InvalidOperation_TableNotSorted(TableIndex tableIndex)
at System.Reflection.Metadata.Ecma335.MetadataBuilder.ValidateInterfaceImplTable()
at System.Reflection.Metadata.Ecma335.MetadataBuilder.ValidateOrder()
at System.Reflection.Metadata.Ecma335.MetadataRootBuilder.Serialize(BlobBuilder builder, Int32 methodBodyStreamRva, Int32 mappedFieldDataStreamRva)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Sorting issues with metadata on Books app
I have a collection of eBooks and PDF files that I manage using the software "Calibre", where I have added metadata, including "sort...
Read more >Moz Pro Site Crawl Managing Metadata Issues - Help Hub
What's Covered? · Overview of Moz Pro Site Crawl Metadata Issues · Missing Title · Title Too Long · Title Too Short ·...
Read more >6 Reasons Why You Shouldn't Buy Metadata
We honestly believe that most demand gen teams will see a major impact by using Metadata.
Read more >Common Mistakes Companies Make with Metadata ...
Is your metadata well-managed? A panel of pros weigh in on the most common metadata management mistakes (and how your company can avoid...
Read more >The Problem of Metadata
Metadata is encoded in order to allow it to be processed by a computer program. It may be encoded by using different protocols...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@SvenGroot Thanks a lot for spotting a solution! have extended the unit tests as well, and indeed, we do increase the coverage with your fix.
CC @per-samuelsson @TalAloni
@vermorel I’ve tested this and can confirm that the original problem is already solved so we can close this issue.