From af537fbe025762e299d2f3334cc94ef5ab8d51a1 Mon Sep 17 00:00:00 2001 From: js6pak Date: Fri, 22 Nov 2024 21:34:33 +0100 Subject: [PATCH] Ignore explicit interface implementations (#15) --- BepInEx.AssemblyPublicizer/AssemblyPublicizer.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BepInEx.AssemblyPublicizer/AssemblyPublicizer.cs b/BepInEx.AssemblyPublicizer/AssemblyPublicizer.cs index 3558a6c..b7c33bc 100644 --- a/BepInEx.AssemblyPublicizer/AssemblyPublicizer.cs +++ b/BepInEx.AssemblyPublicizer/AssemblyPublicizer.cs @@ -118,6 +118,18 @@ private static void Publicize(MethodDefinition methodDefinition, OriginalAttribu if (methodDefinition.IsCompilerControlled) return; + // Ignore explicit interface implementations because you can't call them directly anyway and it confuses IDEs + if (methodDefinition is { IsVirtual: true, IsFinal: true, DeclaringType: not null }) + { + foreach (var implementation in methodDefinition.DeclaringType.MethodImplementations) + { + if (implementation.Body == methodDefinition) + { + return; + } + } + } + if (!methodDefinition.IsPublic) { if (!ignoreCompilerGeneratedCheck && !options.PublicizeCompilerGenerated && methodDefinition.IsCompilerGenerated())