Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/12 15:47:26 (12 years ago)
Author:
spimming
Message:

#1680: merged changes from trunk into branch

Location:
branches/HeuristicLab.Hive.Azure
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure

  • branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r6866 r7669  
    102102  </PropertyGroup>
    103103  <ItemGroup>
    104     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL" />
     104    <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
     105      <Private>False</Private>
     106    </Reference>
    105107    <Reference Include="System" />
    106108    <Reference Include="System.Core">
     
    309311  <ItemGroup>
    310312    <Content Include="ICSharpCode.SharpZipLib License.txt">
    311       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     313      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    312314    </Content>
    313315    <Content Include="ICSharpCode.SharpZipLib.dll">
    314       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     316      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    315317    </Content>
    316318    <EmbeddedResource Include="Advanced\DeploymentService\services.heuristiclab.com.cer" />
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs

    r7270 r7669  
    7575      foreach (Type t in GetTypes(type)) {
    7676        object instance = null;
    77         try { instance = Activator.CreateInstance(t); }
    78         catch { }
     77        try { instance = Activator.CreateInstance(t); } catch { }
    7978        if (instance != null) instances.Add(instance);
    8079      }
     
    124123    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false) {
    125124      try {
     125        // necessary to make sure the exception is immediately thrown
     126        // instead of later when the enumerable is iterated?
    126127        var assemblyTypes = assembly.GetTypes();
    127128
    128         var buildTypes = from t in assemblyTypes
     129        var buildTypes = from t in assembly.GetTypes()
     130                         where CheckTypeCompatibility(type, t)
    129131                         where !IsNonDiscoverableType(t)
    130                          where CheckTypeCompatibility(type, t)
    131                          where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     132                         where onlyInstantiable == false ||
     133                               (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    132134                         select BuildType(t, type);
    133135
     
    135137               where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    136138               select t;
    137       }
    138       catch (TypeLoadException) {
     139      } catch (TypeLoadException) {
    139140        return Enumerable.Empty<Type>();
    140       }
    141       catch (ReflectionTypeLoadException) {
     141      } catch (ReflectionTypeLoadException) {
    142142        return Enumerable.Empty<Type>();
    143143      }
     
    152152        return true;
    153153      if (type.IsGenericType && other.IsGenericType) {
     154        var otherGenericArguments = other.GetGenericArguments();
     155        var typeGenericArguments = type.GetGenericArguments();
     156
     157        //check type arguments count
     158        if (otherGenericArguments.Length != typeGenericArguments.Length)
     159          return false;
     160
     161        //check type arguments & constraints
     162        int i = 0;
     163        foreach (var genericArgument in typeGenericArguments) {
     164          if (otherGenericArguments[i].IsGenericParameter) {
     165            foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
     166              if (!constraint.IsAssignableFrom(genericArgument)) return false;
     167          } else if (genericArgument != otherGenericArguments[i]) return false;
     168          i++;
     169        }
     170        //check types
    154171        try {
    155           if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments())))
     172          var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
     173          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    156174            return true;
    157         }
    158         catch (Exception) { }
     175        } catch (Exception) { }
    159176      }
    160177      return false;
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs

    r7270 r7669  
    235235      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    236236      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    237              where !IsDynamicAssembly(asm)
     237             where !asm.IsDynamic && !string.IsNullOrEmpty(asm.Location)
    238238             where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase))
    239239             from t in GetTypes(type, asm, onlyInstantiable, includeGenericTypeDefinitions)
     
    249249      }
    250250      return result;
    251     }
    252 
    253     private static bool IsDynamicAssembly(Assembly asm) {
    254       return (asm is System.Reflection.Emit.AssemblyBuilder) || string.IsNullOrEmpty(asm.Location);
    255251    }
    256252
     
    266262    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
    267263      var buildTypes = from t in assembly.GetTypes()
     264                       where CheckTypeCompatibility(type, t)
    268265                       where !IsNonDiscoverableType(t)
    269                        where CheckTypeCompatibility(type, t)
    270266                       where onlyInstantiable == false ||
    271267                             (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     
    286282        return true;
    287283      if (type.IsGenericType && other.IsGenericType) {
     284        var otherGenericArguments = other.GetGenericArguments();
     285        var typeGenericArguments = type.GetGenericArguments();
     286
     287        //check type arguments count
     288        if (otherGenericArguments.Length != typeGenericArguments.Length)
     289          return false;
     290
     291        //check type arguments & constraints
     292        int i = 0;
     293        foreach (var genericArgument in typeGenericArguments) {
     294          if (otherGenericArguments[i].IsGenericParameter) {
     295            foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
     296              if (!constraint.IsAssignableFrom(genericArgument)) return false;
     297          } else if (genericArgument != otherGenericArguments[i]) return false;
     298          i++;
     299        }
     300        //check types
    288301        try {
    289           if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments())))
     302          var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
     303          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    290304            return true;
    291305        }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/app.config

    r4495 r7669  
    3535          maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text"
    3636          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    37           <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000"
     37          <readerQuotas maxDepth="32" maxStringContentLength="200000000" maxArrayLength="200000000"
    3838            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    3939          <reliableSession ordered="true" inactivityTimeout="00:10:00"
     
    5252          maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text"
    5353          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    54           <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000"
     54          <readerQuotas maxDepth="32" maxStringContentLength="200000000" maxArrayLength="200000000"
    5555            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    5656          <reliableSession ordered="true" inactivityTimeout="00:10:00"
Note: See TracChangeset for help on using the changeset viewer.