Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17865


Ignore:
Timestamp:
03/09/21 08:16:23 (3 years ago)
Author:
gkronber
Message:

#3089: merged r17781 from trunk to stable

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab-3.3/PluginDependenciesTest.cs

    r17181 r17865  
    3939    [ClassInitialize]
    4040    public static void MyClassInitialize(TestContext testContext) {
    41       loadedPlugins = PluginLoader.Assemblies.Where(PluginLoader.IsPluginAssembly).ToDictionary(a => a, GetPluginFromAssembly);
     41      try {
     42        loadedPlugins = PluginLoader.Assemblies.Where(PluginLoader.IsPluginAssembly).ToDictionary(a => a, GetPluginFromAssembly);
     43      } catch (BadImageFormatException e) {
     44        var message = string.Join(Environment.NewLine, "Could not load all types. Check if test process architecture is set to x64.", string.Empty, "Exception:", e);
     45        Assert.Fail(message);
     46      }
     47
    4248      pluginNames = loadedPlugins.ToDictionary(a => a.Key.GetName().FullName, a => GetPluginName(a.Value));
    4349
  • stable/HeuristicLab.Tests/HeuristicLab.Persistence.Attic/PersistenceConsistencyChecks.cs

    r17165 r17865  
    22using System.Collections.Generic;
    33using System.Linq;
     4using System.Reflection;
    45using HEAL.Attic;
    56using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    1617      var dict = new Dictionary<Guid, string>();
    1718      var duplicates = new Dictionary<string, string>();
    18       // using AppDomain instead of ApplicationManager so that NonDiscoverableTypes are also checked
    19       foreach (Type type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())) {
    20         var attr = StorableTypeAttribute.GetStorableTypeAttribute(type);
    21         if (attr == null)
    22           continue;
    2319
    24         foreach (var guid in attr.Guids) {
    25           if (!dict.ContainsKey(guid)) {
    26             dict.Add(guid, type.FullName);
    27           } else {
    28             duplicates.Add(type.FullName, dict[guid]);
     20      try {
     21        // using AppDomain instead of ApplicationManager so that NonDiscoverableTypes are also checked
     22        foreach (Type type in AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())) {
     23          var attr = StorableTypeAttribute.GetStorableTypeAttribute(type);
     24          if (attr == null)
     25            continue;
     26
     27          foreach (var guid in attr.Guids) {
     28            if (!dict.ContainsKey(guid)) {
     29              dict.Add(guid, type.FullName);
     30            } else {
     31              duplicates.Add(type.FullName, dict[guid]);
     32            }
    2933          }
    3034        }
     35      } catch (ReflectionTypeLoadException e) {
     36        var loaderExeptions = string.Join("-----" + Environment.NewLine, e.LoaderExceptions.Select(x => x.ToString()));
     37        var message = string.Join(Environment.NewLine, "Could not load all types. Check if test process architecture is set to x64.",
     38          string.Empty, "Exception:", e, string.Empty, "LoaderExceptions:", loaderExeptions);
     39        Assert.Fail(message);
    3140      }
    3241
Note: See TracChangeset for help on using the changeset viewer.