Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/27/10 17:08:03 (14 years ago)
Author:
gkronber
Message:

Fixed caching and resolve event handler in plugin infrastructure to fix the bug that the SqlServerCompact assembly is not found when opening a db connection. #854 (System.Data.SqlServerCe assembly is not loaded correctly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs

    r2688 r2690  
    7575      loadedAssemblies = new Dictionary<string, Assembly>();
    7676      loadedPlugins = new List<IPlugin>();
    77       // needed for the special case when assemblies are loaded dynamically via LoadAssemblies()
    7877      AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
    7978        if (loadedAssemblies.ContainsKey(args.Name)) {
     
    103102      // load all loadable plugins (all dependencies available) into the execution context
    104103      foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
    105         foreach (AssemblyName assemblyName in desc.AssemblyNames) {
    106           var asm = Assembly.Load(assemblyName);
    107 
     104        foreach (string fileName in desc.AssemblyLocations) {
     105          var asm = Assembly.LoadFrom(fileName);
     106          RegisterLoadedAssembly(asm);
    108107          // instantiate and load all plugins in this assembly
    109108          foreach (var plugin in GetInstances<IPlugin>(asm)) {
     
    213212      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    214213      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    215              where pluginDesc.AssemblyNames.Any(asmName => asmName.FullName.Equals(asm.GetName().FullName))
     214             where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase))
    216215             from t in GetTypes(type, asm, onlyInstantiable)
    217216             select t;
     
    283282    public IPluginDescription GetDeclaringPlugin(Type type) {
    284283      foreach (PluginDescription info in Plugins) {
    285         if (info.AssemblyNames.Contains(type.Assembly.GetName())) return info;
     284        if (info.AssemblyLocations.Contains(Path.GetFullPath(type.Assembly.Location))) return info;
    286285      }
    287286      return null;
Note: See TracChangeset for help on using the changeset viewer.