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