public override MethodDesc GetFinalizer() { MethodDesc typicalFinalizer = _typeDef.GetFinalizer(); if (typicalFinalizer == null) { return(null); } MetadataType typeInHierarchy = this; // Note, we go back to the type definition/typical method definition in this code. // If the finalizer is implemented on a base type that is also a generic, then the // typicalFinalizer in that case is a MethodForInstantiatedType for an instantiated type // which is instantiated over the open type variables of the derived type. while (typicalFinalizer.OwningType.GetTypeDefinition() != typeInHierarchy.GetTypeDefinition()) { typeInHierarchy = typeInHierarchy.MetadataBaseType; } if (typeInHierarchy == typicalFinalizer.OwningType) { return(typicalFinalizer); } else { Debug.Assert(typeInHierarchy is InstantiatedType); return(_typeDef.Context.GetMethodForInstantiatedType(typicalFinalizer.GetTypicalMethodDefinition(), (InstantiatedType)typeInHierarchy)); } }
public override MethodDesc GetFinalizer() { MethodDesc typicalFinalizer = _typeDef.GetFinalizer(); if (typicalFinalizer == null) { return(null); } return(_typeDef.Context.GetMethodForInstantiatedType(typicalFinalizer, this)); }