Skip to content

Commit

Permalink
Merged.
Browse files Browse the repository at this point in the history
  • Loading branch information
yallie committed Mar 10, 2012
2 parents 0f7ec0d + e6ed5d0 commit 92bfd2b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Irony.GrammarExplorer/GrammarLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GrammarLoader {
private static HashSet<string> _probingPaths = new HashSet<string>();
private Dictionary<string, CachedAssembly> _cachedGrammarAssemblies = new Dictionary<string, CachedAssembly>();
private static Dictionary<string, Assembly> _loadedAssembliesByNames = new Dictionary<string, Assembly>();
private static Dictionary<string, Assembly> _loadedAssembliesByLocation = new Dictionary<string, Assembly>();
private static HashSet<Assembly> _loadedAssemblies = new HashSet<Assembly>();
private static bool _enableBrowsingForAssemblyResolution = false;

static GrammarLoader() {
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 92bfd2b

Please sign in to comment.