question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Metadata ordering issues

See original GitHub issue

Some 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:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vermorelcommented, Sep 24, 2019

@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

1reaction
OlegRacommented, May 10, 2022

@vermorel I’ve tested this and can confirm that the original problem is already solved so we can close this issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found