From a560e1dfdc7e010f0944712af0ef269c80f3170a Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Mon, 13 May 2024 09:27:46 -0700 Subject: [PATCH] Rewrite mscorlib 2 to mscorlib 4 --- Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs b/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs index a77cfab5..55ede97a 100644 --- a/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs +++ b/Il2CppInterop.Generator/Passes/Pass90WriteToDisk.cs @@ -14,8 +14,9 @@ public static void DoPass(RewriteGlobalContext context, GeneratorOptions options var module = asmContext.NewAssembly.ManifestModule; foreach (var reference in module.AssemblyReferences) { - // TODO: Instead of a hack, set correctly initially via source generator - if (reference.Name == "System.Private.CoreLib") + // System.Private.CoreLib needs rewriting because references can get created during the rewrite process. + // mscorlib needs rewriting because we initially set 2.0.0.0 as the version for resolving references. + if (reference.Name?.Value is "System.Private.CoreLib" or "mscorlib") { CorlibReferences.RewriteReferenceToMscorlib(reference); continue;