Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/19 08:14:56 (5 years ago)
Author:
gkronber
Message:

#2994 merge r16933:16942 from trunk to branch

Location:
branches/2994-AutoDiffForIntervals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals

  • branches/2994-AutoDiffForIntervals/HeuristicLab.Core

  • branches/2994-AutoDiffForIntervals/HeuristicLab.Core/3.3/PersistenceContentManager.cs

    r16911 r16943  
    2424using HeuristicLab.Persistence.Default.Xml;
    2525using HEAL.Attic;
     26using System;
    2627
    2728namespace HeuristicLab.Core {
     
    3233      // first try to load using the new persistence format
    3334      var ser = new ProtoBufSerializer();
    34       var o = (IStorableContent)ser.Deserialize(filename, out SerializationInfo info);
    35       if (info.SerializedTypes != null) {
    36         return o;
     35      try {
     36        return (IStorableContent)ser.Deserialize(filename, out SerializationInfo info);
     37      } catch (Exception e) {
     38        try {
     39          // try old format if new format fails
     40          return XmlParser.Deserialize<IStorableContent>(filename);
     41        } catch (Exception e2) {
     42          throw new AggregateException($"Cannot open file {filename}", e, e2);
     43        }
    3744      }
    38       // try old format if new format fails
    39       return XmlParser.Deserialize<IStorableContent>(filename);
    4045    }
    4146
Note: See TracChangeset for help on using the changeset viewer.