Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Attributes/NonDiscoverableTypeAttribute.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Attributes/NonDiscoverableTypeAttribute.cs	(revision 5796)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Attributes/NonDiscoverableTypeAttribute.cs	(revision 5796)
@@ -0,0 +1,37 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+
+namespace HeuristicLab.PluginInfrastructure {
+  /// <summary>
+  /// This attribute can be used to specify that a class is excluded from type discovery
+  /// </summary>
+  [AttributeUsage(AttributeTargets.Class)]
+  public sealed class NonDiscoverableTypeAttribute : System.Attribute {
+    /// <summary>
+    /// Initializes a new instance of <see cref="NonDiscoverableTypeAttribute"/>.
+    /// </summary>
+    public NonDiscoverableTypeAttribute()
+      : base() {
+    }
+  }
+}
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs	(revision 5796)
@@ -100,5 +100,8 @@
       foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
         foreach (string fileName in desc.AssemblyLocations) {
-          var asm = Assembly.LoadFrom(fileName);
+          // load assembly reflection only first to get the full assembly name
+          var reflectionOnlyAssembly = Assembly.ReflectionOnlyLoadFrom(fileName);
+          // load the assembly into execution context using full assembly name
+          var asm = Assembly.Load(reflectionOnlyAssembly.FullName);
           RegisterLoadedAssembly(asm);
           // instantiate and load all plugins in this assembly
@@ -255,6 +258,12 @@
       return from t in assembly.GetTypes()
              where CheckTypeCompatibility(type, t)
-             where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
+             where onlyInstantiable == false ||
+                (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
+             where !IsNonDiscoverableType(t)
              select BuildType(t, type);
+    }
+
+    private static bool IsNonDiscoverableType(Type t) {
+      return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
     }
 
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj	(revision 5796)
@@ -21,5 +21,6 @@
     </UpgradeBackupLocation>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile></TargetFrameworkProfile>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
@@ -213,4 +214,5 @@
     <Compile Include="Attributes\ApplicationAttribute.cs" />
     <Compile Include="Attributes\ContactInformationAttribute.cs" />
+    <Compile Include="Attributes\NonDiscoverableTypeAttribute.cs" />
     <Compile Include="Attributes\PluginAttribute.cs" />
     <Compile Include="Attributes\PluginDependencyAttribute.cs" />
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs	(revision 5796)
@@ -122,4 +122,5 @@
                where CheckTypeCompatibility(type, t)
                where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
+               where !IsNonDiscoverableType(t)
                select BuildType(t, type);
       }
@@ -130,4 +131,8 @@
         return Enumerable.Empty<Type>();
       }
+    }
+
+    private static bool IsNonDiscoverableType(Type t) {
+      return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
     }
 
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/ApplicationDescription.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/ApplicationDescription.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/ApplicationDescription.cs	(revision 5796)
@@ -27,5 +27,5 @@
   /// </summary>
   [Serializable]
-  internal sealed class ApplicationDescription : IApplicationDescription {
+  public sealed class ApplicationDescription : IApplicationDescription {
     private string name;
 
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs	(revision 5796)
@@ -54,5 +54,5 @@
     /// Gets all installed applications.
     /// </summary>
-    internal IEnumerable<ApplicationDescription> Applications {
+    public IEnumerable<ApplicationDescription> Applications {
       get { return applications; }
     }
@@ -75,9 +75,11 @@
       AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
       setup.PrivateBinPath = pluginDir;
+      // probing should only occur in PrivateBinPath (not in ApplicationBase). This is enforced by the value string.Empty
+      setup.PrivateBinPathProbe = string.Empty;
       AppDomain pluginDomain = null;
       try {
         pluginDomain = AppDomain.CreateDomain("plugin domain", null, setup);
         Type pluginValidatorType = typeof(PluginValidator);
-        PluginValidator remoteValidator = (PluginValidator)pluginDomain.CreateInstanceAndUnwrap(pluginValidatorType.Assembly.FullName, pluginValidatorType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null, null);
+        PluginValidator remoteValidator = (PluginValidator)pluginDomain.CreateInstanceAndUnwrap(pluginValidatorType.Assembly.FullName, pluginValidatorType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null);
         remoteValidator.PluginDir = pluginDir;
         // forward all events from the remoteValidator to listeners
@@ -110,5 +112,5 @@
     /// </summary>
     /// <param name="appInfo">application to run</param>
-    internal void Run(ApplicationDescription appInfo) {
+    public void Run(ApplicationDescription appInfo) {
       if (!initialized) throw new InvalidOperationException("PluginManager is not initialized. DiscoverAndCheckPlugins() must be called before Run()");
       // create a separate AppDomain for the application
@@ -124,5 +126,5 @@
         Type applicationManagerType = typeof(DefaultApplicationManager);
         DefaultApplicationManager applicationManager =
-          (DefaultApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null, null);
+          (DefaultApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null);
         applicationManager.PluginLoaded += applicationManager_PluginLoaded;
         applicationManager.PluginUnloaded += applicationManager_PluginUnloaded;
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs	(revision 5796)
@@ -117,6 +117,8 @@
       CheckPluginDependencyCycles(pluginDescriptions);
 
-      // recursively check if all necessary plugins are available and not disabled
-      // disable plugins with missing or disabled dependencies
+      // 1st time recursively check if all necessary plugins are available and not disabled
+      // disable plugins with missing or disabled dependencies 
+      // to prevent that plugins with missing dependencies are loaded into the execution context
+      // in the next step
       CheckPluginDependencies(pluginDescriptions);
 
@@ -124,4 +126,8 @@
       // disables plugins that are not loaded correctly
       CheckExecutionContextLoad(pluginDescriptions);
+
+      // 2nd time recursively check if all necessary plugins have been loaded successfully and not disabled
+      // disable plugins with for which dependencies could not be loaded successfully
+      CheckPluginDependencies(pluginDescriptions);
 
       // mark all plugins as enabled that were not disabled in CheckPluginFiles, CheckPluginAssemblies, 
@@ -135,16 +141,15 @@
 
       plugins = pluginDescriptions;
-      DiscoverApplications();
-    }
-
-    private void DiscoverApplications() {
+      DiscoverApplications(pluginDescriptions);
+    }
+
+    private void DiscoverApplications(IEnumerable<PluginDescription> pluginDescriptions) {
       applications = new List<ApplicationDescription>();
-
-      foreach (IApplication application in GetApplications()) {
+      foreach (IApplication application in GetApplications(pluginDescriptions)) {
         Type appType = application.GetType();
         ApplicationAttribute attr = (from x in appType.GetCustomAttributes(typeof(ApplicationAttribute), false)
                                      select (ApplicationAttribute)x).Single();
-        var declaringPlugin = GetDeclaringPlugin(appType, plugins);
         ApplicationDescription info = new ApplicationDescription();
+        PluginDescription declaringPlugin = GetDeclaringPlugin(appType, pluginDescriptions);
         info.Name = application.Name;
         info.Version = declaringPlugin.Version;
@@ -158,9 +163,10 @@
     }
 
-    private static IEnumerable<IApplication> GetApplications() {
+    private static IEnumerable<IApplication> GetApplications(IEnumerable<PluginDescription> pluginDescriptions) {
       return from asm in AppDomain.CurrentDomain.GetAssemblies()
              from t in asm.GetTypes()
              where typeof(IApplication).IsAssignableFrom(t) &&
                !t.IsAbstract && !t.IsInterface && !t.HasElementType
+             where GetDeclaringPlugin(t, pluginDescriptions).PluginState != PluginState.Disabled
              select (IApplication)Activator.CreateInstance(t);
     }
@@ -173,5 +179,5 @@
       }
       // try to load each .dll file in the plugin directory into the reflection only context
-      foreach (string filename in Directory.GetFiles(baseDir, "*.dll")) {
+      foreach (string filename in Directory.GetFiles(baseDir, "*.dll").Union(Directory.GetFiles(baseDir, "*.exe"))) {
         try {
           Assembly asm = Assembly.ReflectionOnlyLoadFrom(filename);
@@ -500,21 +506,30 @@
                                                                                 .Where(x => x.PluginState != PluginState.Disabled))) {
         foreach (string assemblyLocation in desc.AssemblyLocations) {
-          try {
-            // now load the assemblies into the execution context  
-            // this can still lead to an exception
-            // even when the assembly was successfully loaded into the reflection only context before 
-            var asm = Assembly.LoadFrom(assemblyLocation);
-          }
-          catch (BadImageFormatException) {
-            desc.Disable(Path.GetFileName(assemblyLocation) + " is not a valid assembly.");
-          }
-          catch (FileLoadException) {
-            desc.Disable("Can't load file " + Path.GetFileName(assemblyLocation));
-          }
-          catch (FileNotFoundException) {
-            desc.Disable("File " + Path.GetFileName(assemblyLocation) + " is missing.");
-          }
-          catch (SecurityException) {
-            desc.Disable("File " + Path.GetFileName(assemblyLocation) + " can't be loaded because of security constraints.");
+          if (desc.PluginState != PluginState.Disabled) {
+            try {
+              string assemblyName = (from assembly in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()
+                                     where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
+                                     select assembly.FullName).Single();
+              // now load the assemblies into the execution context  
+              // this can still lead to an exception
+              // even when the assemby was successfully loaded into the reflection only context before 
+              var asm = Assembly.Load(assemblyName);
+            }
+            catch (BadImageFormatException) {
+              desc.Disable(Path.GetFileName(assemblyLocation) + " is not a valid assembly.");
+            }
+            catch (FileLoadException) {
+              desc.Disable("Can't load file " + Path.GetFileName(assemblyLocation));
+            }
+            catch (FileNotFoundException) {
+              desc.Disable("File " + Path.GetFileName(assemblyLocation) + " is missing.");
+            }
+            catch (SecurityException) {
+              desc.Disable("File " + Path.GetFileName(assemblyLocation) + " can't be loaded because of security constraints.");
+            }
+            catch (NotSupportedException ex) {
+              // disable the plugin
+              desc.Disable("Problem while loading plugin assemblies:" + Environment.NewLine + "NotSupportedException: " + ex.Message);
+            }
           }
         }
@@ -533,6 +548,6 @@
           foreach (string assemblyLocation in desc.AssemblyLocations) {
             var asm = (from assembly in assemblies
-                      where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
-                      select assembly)
+                       where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
+                       select assembly)
                       .Single();
 
@@ -582,5 +597,5 @@
     }
 
-    private PluginDescription GetDeclaringPlugin(Type appType, IEnumerable<PluginDescription> plugins) {
+    private static PluginDescription GetDeclaringPlugin(Type appType, IEnumerable<PluginDescription> plugins) {
       return (from p in plugins
               from asmLocation in p.AssemblyLocations
Index: branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Sandboxing/SandboxManager.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Sandboxing/SandboxManager.cs	(revision 5681)
+++ branches/DataAnalysis Refactoring/HeuristicLab.PluginInfrastructure/3.3/Sandboxing/SandboxManager.cs	(revision 5796)
@@ -85,5 +85,5 @@
       Type applicationManagerType = typeof(DefaultApplicationManager);
       DefaultApplicationManager applicationManager =
-        (DefaultApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null, null);
+        (DefaultApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null);
       PluginManager pm = new PluginManager(applicationBase);
       pm.DiscoverAndCheckPlugins();
