gluck/il-repack

ReferenceFixator fails to fix MethodReference if the method is defined on the base class.

bucurb opened this issue · 2 comments

Hello,

I'm trying to merge some AspNetCore dlls. At some point, the merge tries to fix-up the references in type Microsoft.AspNetCore.Server.Kestrel.Core.Internal.ConnectionLimitMiddleware. This type has a OnConnectionAsync method, which will at some point do connection.Features.Set..., and thus have the ReferenceFixator attempt to fix the MethodReference for Microsoft.AspNetCore.Http.Features.IFeatureCollection Microsoft.AspNetCore.Connections.ConnectionContext::get_Features().

The reference fixator will correctly go through the if (declaringType.IsDefinition && !method.IsDefinition) but fail to find a definition from MethodDefinition def = new ReflectionHelper(_repackContext).FindMethodDefinitionInType((TypeDefinition)declaringType, method);. This is because the method is not defined on the ConnectionContext class, but on its base, BaseConnectionContext. Both these classes are abstract so I don't understand why the code does not scan the inheritance hierarchy upwards when searching for a method definition, is this a bug?

Could you please try the latest version and see if this is still a problem?
https://www.nuget.org/packages/ILRepack/2.0.23

If I'm reading this right, this should have been fixed with:
22e076b

The bug was most likely:
#219