title: Assembly.GetTypes() generating LoaderException Error
body: <p>I tried googling a lot but failed to found a solution.</p>
  
  <p>Please help me through.</p>
  
  <p>I have a windows application setup wizard which will run a installer class where custom actions are assigned to do.</p>
  
  <p>The project lies with a plugin architecture. </p>
  
  <p>While installing, i need to install a printer driver, installer class have code to install it, by calling that plugin.</p>
  
  <p>But, when i try to retrieve the loaded plugin's GetTypes() property, i am receiving a loader-exception Error and Installer will Quit.</p>
  
  <p>If i run my windows application, then GetTypes() property is working properly.</p>
  
  <p>Here is my code. Please have a look and check if anything went wrong.</p>
  
  <pre><code>   private static List&lt;Assembly&gt; LoadPlugInAssemblies()
      {
  
          DirectoryInfo dInfo = new DirectoryInfo(Path.Combine(Assembly.GetExecutingAssembly().Location.Replace("PluginSDK.dll", ""), "Plugins")); 
  
          FileInfo[] files = dInfo.GetFiles("*.dll");
  
          List&lt;Assembly&gt; plugInAssemblyList = new List&lt;Assembly&gt;();
  
          if (null != files)
          {
              foreach (FileInfo file in files)
              {
                  plugInAssemblyList.Add(Assembly.LoadFile(file.FullName));
              }
          }
          return plugInAssemblyList;
      }
  
      static List&lt;IUserFunctionPlugin&gt; GetPlugIns(List&lt;Assembly&gt; assemblies)
      {
          List&lt;Type&gt; availableTypes = new List&lt;Type&gt;();
  
          foreach (Assembly currentAssembly in assemblies)
              availableTypes.AddRange(currentAssembly.GetTypes());
  
          List&lt;Type&gt; pluginList = availableTypes.FindAll(delegate(Type t)
          {
              List&lt;Type&gt; interfaceTypes = new List&lt;Type&gt;(t.GetInterfaces());
              object[] arr = t.GetCustomAttributes(typeof(PluginAttributes), true);
              return !(arr == null || arr.Length == 0) &amp;&amp; interfaceTypes.Contains(typeof(IUserFunctionPlugin));
          });
  
          // CONVERT THE LIST OF OBJECTS TO AN INSTANTIATED LIST OF IPlugins
          return pluginList.ConvertAll&lt;IUserFunctionPlugin&gt;(delegate(Type t) { return Activator.CreateInstance(t) as IUserFunctionPlugin; });
      }
  </code></pre>
  
  <p>I tried with Assembly.ReflectionOnlyLoad but resulted with the same error.
  Thanks in Advance!!!</p>