diff --git a/Irony.GrammarExplorer/GrammarLoader.cs b/Irony.GrammarExplorer/GrammarLoader.cs index 6723bbe..e4aa80f 100644 --- a/Irony.GrammarExplorer/GrammarLoader.cs +++ b/Irony.GrammarExplorer/GrammarLoader.cs @@ -30,7 +30,7 @@ class GrammarLoader { private static HashSet _probingPaths = new HashSet(); private Dictionary _cachedGrammarAssemblies = new Dictionary(); private static Dictionary _loadedAssembliesByNames = new Dictionary(); - private static Dictionary _loadedAssembliesByLocation = new Dictionary(); + private static HashSet _loadedAssemblies = new HashSet(); private static bool _enableBrowsingForAssemblyResolution = false; static GrammarLoader() { @@ -190,13 +190,11 @@ public static Assembly LoadAssembly(string fileName) { // try to load assembly using the standard policy var assembly = Assembly.LoadFrom(fileName); // if the standard policy returned the old version, force reload - Assembly oldVersion; - if (_loadedAssembliesByLocation.TryGetValue(fileName, out oldVersion)) { - if (assembly == oldVersion) + if (_loadedAssemblies.Contains(assembly)) { assembly = Assembly.Load(File.ReadAllBytes(fileName)); } - else // cache the loaded assembly by its location - _loadedAssembliesByLocation[fileName] = assembly; + // cache the loaded assembly by its location + _loadedAssemblies.Add(assembly); return assembly; } }