https://github.com/mono/linker/blob/9e3191cad279e945a4e2c99340454959fec637b0/src/linker/Linker.Steps/MarkStep.cs#L2469-L2492
This code is trying to ensure that if an explicit interface implementation method was marked, the appropriate member of the interface list is also preserved.
The code falls victim to Cecil's behavior where the act of resolving a TypeRef/MethodRef strips away the genericness information.
As a result, for code like this:
class Foo : IFoo<object>, IFoo<string>
{
int IFoo<object> Frob() => 0;
int IFoo<string> Frob() => 0;
}
Will end up preserving the first IFoo entry in the interface list, irrespective of whether IFoo<object>.Frob or IFoo<string>.Frob was the one responsible for MarkExplicitInterfaceImplementation getting called.
I think this is low impact, since we can only get there if the explicit impl was rooted through ILLinkTrim, but ILLinkTrim was the motivating factor why MarkExplicitInterfaceImplementation was added in the first place, so YMMV.
Found while investigating #1421. This issue gives the other issue a more weird failure mode.
https://github.com/mono/linker/blob/9e3191cad279e945a4e2c99340454959fec637b0/src/linker/Linker.Steps/MarkStep.cs#L2469-L2492
This code is trying to ensure that if an explicit interface implementation method was marked, the appropriate member of the interface list is also preserved.
The code falls victim to Cecil's behavior where the act of resolving a TypeRef/MethodRef strips away the genericness information.
As a result, for code like this:
Will end up preserving the first IFoo entry in the interface list, irrespective of whether
IFoo<object>.FroborIFoo<string>.Frobwas the one responsible forMarkExplicitInterfaceImplementationgetting called.I think this is low impact, since we can only get there if the explicit impl was rooted through ILLinkTrim, but ILLinkTrim was the motivating factor why
MarkExplicitInterfaceImplementationwas added in the first place, so YMMV.Found while investigating #1421. This issue gives the other issue a more weird failure mode.