From ca966a464c2262a7b51f6395fe901b12b832e7ee Mon Sep 17 00:00:00 2001 From: breadbyte <14045257+breadbyte@users.noreply.github.com> Date: Sun, 14 Jul 2024 01:46:43 +0800 Subject: [PATCH] Ensure that the cached version of MCC is refreshed every update (#2760) fixes #2758 this happened because we added sentry in a future release, but the cache was using an old executable, so it couldn't find the assembly. --- .../Scripting/DynamicRun/Builder/Compiler.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Scripting/DynamicRun/Builder/Compiler.cs b/MinecraftClient/Scripting/DynamicRun/Builder/Compiler.cs index 9bd865c2e2..1e99f226ea 100644 --- a/MinecraftClient/Scripting/DynamicRun/Builder/Compiler.cs +++ b/MinecraftClient/Scripting/DynamicRun/Builder/Compiler.cs @@ -94,7 +94,15 @@ private static CSharpCompilation GenerateCode(string sourceCode, string fileName { if (file.EndsWith("mcc-executable")) { - useExisting = true; + // Check if the file is the same as the current executable. + if (File.ReadAllBytes(file).SequenceEqual(File.ReadAllBytes(executablePath))) + { + useExisting = true; + break; + } + + // If not, refresh the cache. + File.Delete(file); break; } }