Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-1579

AssemblyTypeScanner.Scan at odds with COMVisible DLLs

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0 RC1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      All environments using code-config

      Description

      In the abstract class AssemblyTypeScanner, method Scan(), it looks for assemblies in one directory. This is at odds with COMVisible DLLs which typically reside in directories all to themselves.

      A possible modif could look like the following where directories are scanned of loaded assemblies:

      /// <summary>
      /// Performs the Scan, respecting all filter settings.
      /// </summary>
      /// <returns></returns>
      public virtual IEnumerable<Type> Scan()
      {
      SetDefaultFilters();

      HashSet<string> folders = new HashSet<string>();
      HashSet<Type> types = new HashSet<Type>();

      Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
      var filteredloadedAssemblies = ApplyAssemblyFiltersTo(loadedAssemblies);

      foreach (var loadedAssembly in filteredloadedAssemblies)
      {
      if (!string.IsNullOrEmpty(loadedAssembly.Location))

      { string path = new FileInfo(loadedAssembly.Location).Directory.FullName; string dir = Path.GetDirectoryName(path); folders.Add(dir); }

      }
      folders.Add(ScanStartFolderPath);

      foreach (var folder in folders)
      {
      foreach (Assembly assembly in GetAllMatchingAssemblies(folder))

      { TypeSources.Add(new AssemblyTypeSource(assembly)); }

      }

      foreach (var typeSource in TypeSources)
      {
      foreach (Type type in typeSource)
      {
      try
      {
      if (IsCompoundPredicateSatisfiedBy(type))
      {
      Logger.Debug(m => m("Satisfied Type:

      {0}", type.FullName));
      types.Add(type);
      }
      }
      catch(FileNotFoundException ex)
      {
      Logger.Warn(m => m("Could not load Type: {0}

      ", type.FullName), ex);
      }
      }
      }

      return types;
      }

        Attachments

          Activity

            People

            • Assignee:
              sbohlen Steve Bohlen
              Reporter:
              wlgrinfeld wolfgang grinfeld
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 0.25d
                0.25d
                Remaining:
                Remaining Estimate - 0.25d
                0.25d
                Logged:
                Time Spent - Not Specified
                Not Specified