From 9247e2c9881eaad77b86ff16a699a17869d41432 Mon Sep 17 00:00:00 2001 From: CreateAndInject Date: Thu, 25 Jan 2024 03:49:31 +0800 Subject: [PATCH] Clean moduleSearchPaths --- src/DotNet/AssemblyResolver.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DotNet/AssemblyResolver.cs b/src/DotNet/AssemblyResolver.cs index f87b5db31..791399d1c 100644 --- a/src/DotNet/AssemblyResolver.cs +++ b/src/DotNet/AssemblyResolver.cs @@ -336,6 +336,8 @@ public bool Remove(AssemblyDef asm) { #if THREAD_SAFE theLock.EnterWriteLock(); try { #endif + if (asm.ManifestModule is { } module) + moduleSearchPaths.Remove(module); return cachedAssemblies.Remove(asmKey); #if THREAD_SAFE } finally { theLock.ExitWriteLock(); } @@ -355,6 +357,7 @@ public void Clear() { #endif asms = new List(cachedAssemblies.Values); cachedAssemblies.Clear(); + moduleSearchPaths.Clear(); #if THREAD_SAFE } finally { theLock.ExitWriteLock(); } #endif