From c884115bcd9b252b3c6ddc1d19c2ceb64d1e0246 Mon Sep 17 00:00:00 2001 From: GG Z <903524121@qq.com> Date: Sat, 31 Jan 2026 21:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=97=E8=8A=82=E6=B5=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=89=BE=E4=B8=8D=E5=88=B0=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AddInManager/AssemLoader.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/AddInManager/AssemLoader.cs b/AddInManager/AssemLoader.cs index eda4bbb..2fca8fd 100644 --- a/AddInManager/AssemLoader.cs +++ b/AddInManager/AssemLoader.cs @@ -116,28 +116,14 @@ namespace AddInManager // 加载复制后的文件 return LoadAddin(destPath); } - private Assembly LoadAddin(string filePath) { Assembly assembly = null; try { - // 【核心修改】:使用字节流加载,而不是 LoadFile - // 这样可以避免文件锁定,并且每次 Load 都会视为新的程序集实例 if (File.Exists(filePath)) { - byte[] assemblyBytes = File.ReadAllBytes(filePath); - byte[] pdbBytes = null; - - // 尝试加载 PDB 以支持调试 - string pdbPath = Path.ChangeExtension(filePath, "pdb"); - if (File.Exists(pdbPath)) - { - pdbBytes = File.ReadAllBytes(pdbPath); - } - - // 使用 Load(bytes, pdbBytes) - assembly = Assembly.Load(assemblyBytes, pdbBytes); + assembly = Assembly.LoadFrom(filePath); } } catch (Exception ex)