public bool RemoveAssembly(Assembly assembly) { if (assembly == default) { throw new NullReferenceException("Assembly is null! This method can't be passed a null instance."); } lock (ObjLock) { if (AssemblyMappings.ContainsKey(assembly)) { if (OutfileMapping.ContainsKey(assembly.Location)) { while (!OutfileMapping.TryRemove(assembly.Location, out var _)) { } ; } var info = AssemblyMappings[assembly]; ReferencesCache.Remove(info.Reference); DomainCache.Remove(assembly); return(true); } } return(false); }