From dbc26d69786423885f322d226682db79c1344d6a Mon Sep 17 00:00:00 2001 From: AraHaan Date: Tue, 12 May 2026 12:29:23 -0400 Subject: [PATCH 1/2] Fixed FormatException when trying to publicize the Photon assemblies in R.E.P.O. Refactor TryGetMetadata method to handle missing metadata correctly and improve comments regarding Photon assemblies. --- .../Extensions.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs b/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs index 5badeea..4a9f355 100644 --- a/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs +++ b/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs @@ -17,9 +17,22 @@ public static bool HasMetadata(this ITaskItem taskItem, string metadataName) public static bool TryGetMetadata(this ITaskItem taskItem, string metadataName, [NotNullWhen(true)] out string? metadata) { - if (taskItem.HasMetadata(metadataName)) + if (!taskItem.HasMetadata(metadataName)) + { + metadata = null; + return false; + } + + // Fix a problem where when one tries to publicize PhotonRealtime, PhotonUnityNetworking, + // and PhotonUnityNetworking.Utilities from the R.E.P.O.GameLibs.Steam nuget package. + // Why is this needed? Because there are mods such as LateJoin that needs access to + // internal fields/methods to these Proton assemblies and avoiding reflection helps solve + // 100% of problems related to modding R.E.P.O. while not sacrificing performance. + // Also the fact that Reflection sucks and way too many bugs can happen with it. + // Problem seems to have existed from 0.4.1 according to git blame. + metadata = taskItem.GetMetadata(metadataName); + if (!string.IsNullOrWhiteSpace(metadata)) { - metadata = taskItem.GetMetadata(metadataName); return true; } From d4748355ce6ed20c330f97063aad8a03c5b17471 Mon Sep 17 00:00:00 2001 From: AraHaan Date: Thu, 14 May 2026 22:16:07 -0400 Subject: [PATCH 2/2] Update BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs Co-authored-by: Joe Clack <28568841+Lordfirespeed@users.noreply.github.com> --- BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs b/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs index 4a9f355..82a91ee 100644 --- a/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs +++ b/BepInEx.AssemblyPublicizer.MSBuild/Extensions.cs @@ -23,13 +23,6 @@ public static bool TryGetMetadata(this ITaskItem taskItem, string metadataName, return false; } - // Fix a problem where when one tries to publicize PhotonRealtime, PhotonUnityNetworking, - // and PhotonUnityNetworking.Utilities from the R.E.P.O.GameLibs.Steam nuget package. - // Why is this needed? Because there are mods such as LateJoin that needs access to - // internal fields/methods to these Proton assemblies and avoiding reflection helps solve - // 100% of problems related to modding R.E.P.O. while not sacrificing performance. - // Also the fact that Reflection sucks and way too many bugs can happen with it. - // Problem seems to have existed from 0.4.1 according to git blame. metadata = taskItem.GetMetadata(metadataName); if (!string.IsNullOrWhiteSpace(metadata)) {