Skip to content
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

OverridableAttribute missing from the decompiled code when using a winmd file. #3177

Open
jlaanstra opened this issue Mar 13, 2024 · 1 comment
Labels
Bug Decompiler The decompiler engine itself

Comments

@jlaanstra
Copy link

Input code

In Windows.winmd from a recent Windows SDK (C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0\Windows.winmd), the Windows.UI.Xaml.UIElement has the following attributes in il:

        .custom instance void [Windows.winmd]Windows.Foundation.Metadata.OverridableAttribute::.ctor() = (
		01 00 00 00
	)
	[Windows.winmd]Windows.UI.Xaml.IUIElementOverrides,
	           .custom instance void [Windows.winmd]Windows.Foundation.Metadata.OverridableAttribute::.ctor() = (
		01 00 00 00
	)

Erroneous output

In the C# code this attribute is not listed.

Details

  • Product in use: ILSpy
  • Version in use: 8.2.0.7535
@jlaanstra jlaanstra added Bug Decompiler The decompiler engine itself labels Mar 13, 2024
@jlaanstra jlaanstra changed the title Attributes missing from the decompiled code when using a winmd file. OverridableAttribute missing from the decompiled code when using a winmd file. Mar 13, 2024
@siegfriedpammer
Copy link
Member

siegfriedpammer commented Mar 16, 2024

Thank you for reporting this. However, these attributes do not belong to the type declaration, but one of its interface implementations, which can be deduced from the .interfaceimpl type ... directive preceding the .custom directive, but is also visible in the 0C CustomAttribute metadata table.

In C# there is no syntax for adding attributes to the base interface list, so they cannot be added to the C# code. We could add them as comments, but I am not sure about that yet.

What I am going to do:

  • add an level of indentation so it's easier to see the attribute target (3e9e7a3)
  • add the metadata token of the custom attribute to the output, so it's easier to work with the metadata (89d97b9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

2 participants