ILSpy
ILSpy copied to clipboard
OverridableAttribute missing from the decompiled code when using a winmd file.
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
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 (3e9e7a3b55be5ad6511e5f7e20b7f6870e87226e)
- add the metadata token of the custom attribute to the output, so it's easier to work with the metadata (89d97b99a074d87fa279959921312d7abbece599)