Free cookie consent management tool by TermsFeed Policy Generator

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

#3089: merged r17781 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • 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.