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.
Problem
I noticed the following output when decompiling an assembly:
That
implements .custom
part seemed wrong, and indeed,ildasm
uses another syntax instead:.interfaceimpl type
(see here).Here is the result:
Solution
Any comments on the approach taken, its consistency with surrounding code, etc.
This PR moves the custom attributes on interface implementations inside the type body and adds one
.interfaceimpl type
declaration for each interface implementation which has a custom attribute.Which part of this PR is most in need of attention/improvement?
While implementing this, I noticed that
ilasm
is inconsistent withildasm
when multiple attributes are applied to an interface implementation. I believeilasm
is wrong here, and reported the following issue:ilasm does not apply multiple custom attributes on interface implementations dotnet/runtime#82373
Because of this, the unit test only applies a single attribute on the interface implementation. I didn't want to add an additional
.expected.il
file just because of this inconsistency.This PR implements the same behavior as in
ildasm
.As for the UI, I wasn't sure if I should highlight the
type
keyword in green (which looked wrong) or in blue (which could lead to many false positives), so I left it as-is.At least one test covering the code changed