Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11472


Ignore:
Timestamp:
10/16/14 15:29:16 (10 years ago)
Author:
jkarder
Message:

#2239: actually fixed IsSerializable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r11471 r11472  
    401401
    402402    private bool IsSerializable(KeyValuePair<string, object> variable) {
    403       var type = variable.Value.GetType();
     403      Type type = null;
    404404      bool serializable;
    405       if (serializableLookup.TryGetValue(type, out serializable))
    406         return serializable;
     405
     406      if (variable.Value != null) {
     407        type = variable.Value.GetType();
     408        if (serializableLookup.TryGetValue(type, out serializable))
     409          return serializable;
     410      }
     411
    407412      var ser = new Serializer(variable, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()), "ROOT", true);
    408413      try {
    409         return serializableLookup[type] = ser.Count() > 0;
     414        serializable = ser.Count() > 0; // try to create all serialization tokens
    410415      } catch (PersistenceException) {
    411         return serializableLookup[type] = false;
    412       }
     416        serializable = false;
     417      }
     418
     419      if (type != null)
     420        serializableLookup[type] = serializable;
     421      return serializable;
    413422    }
    414423    #endregion
Note: See TracChangeset for help on using the changeset viewer.