private void RewriteWrapperMethods ( TypeDefinition type, FieldDefinition entryPoints, IEnumerable <MethodDefinition> entrySignatures ) { var wrapperSignatures = type.Methods.Where(m => m.IsPublic && m.CustomAttributes.Any(a => a.AttributeType.Name == AttributeNames.AutoGenerated) ).ToList(); foreach (var wrapper in wrapperSignatures) { var autoGenerated = wrapper.GetCustomAttribute(AttributeNames.AutoGenerated, throwIfNoneFound: false); if (autoGenerated is null) { continue; } string signatureName = (string)autoGenerated .Fields .First(f => f.Name == "EntryPoint") .Argument .Value; var nativeSignature = entrySignatures.FirstOrDefault(s => s.Name == signatureName); _methodRewriter.Rewrite(wrapper, nativeSignature); } RemoveSupportingAttributes(type); foreach (var nestedType in type.NestedTypes) { RewriteWrapperMethods(nestedType, entryPoints, entrySignatures); } }