in

.NET Opensource

Community for opensource projects by Christoph Rüegg

Serialization Bug?

Last post 05-21-2009 23:47 by Christoph Rüegg. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-19-2009 18:27

    Serialization Bug?

    Firstly I just want to point out that I find this library extremely useful, but I just have a slight problem with it at the moment.

    I'm creating serializable objects that contain Matrix objects. However, when I try to serialize my object, the serialization process throws an exception saying that _luDecompositionOnDemand (which seems to be contained in the Matrix objects) is non-serializable.  I seem to be able to fix the problem simply by putting "[Serializable]" in front of the definition of OnDemandComputation<T> in OnDemandComputation.cs.

    However, I don't really understand the code, so perhaps this hack is not a good solution.

    Please let me know if this is really a bug, or if it's just that I don't understand something.  If it is a bug, does this simple fix seem reasonable?

    Thanks, Anthony.


  • 05-20-2009 14:49 In reply to

    Re: Serialization Bug?

    Yes, you're right. The serialization support was not automatically unit-tested and apparently not well-enough maintained. I just opened bug IRID-212 to fix that.

    You could add the Serializable attribute as an easy fix, but those variables actually don't need to be serialized at all (they're kind of caches), so we'll most likely fix it with a custom ISerializable implementation.

    Thanks,
    Chris

  • 05-20-2009 15:11 In reply to

    Re: Serialization Bug?

    OK - thanks for the quick response.  Looking forward to the next official release :)

    I guess if these fields don't need to be serialized I could also just put the NonSerialized tag in front of them inside the Matrix class.

    Cheers, Anthony.


  • 05-20-2009 15:52 In reply to

    Re: Serialization Bug?

    NonSerialized won't work because these fields must not be null.

    What might work though is to mark OnDemandComputation as Serializable as you suggested, but to mark its _result and _isValid fields as NonSerialized.

  • 05-21-2009 23:47 In reply to

    Re: Serialization Bug?

    FYI, I just fixed that bug (IRID-212) in commit b564e90559fe12fcec1d841662f3a54ef6df8690.
Page 1 of 1 (5 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems