Missing field data with serialization

Posts   
 
    
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 27-May-2008 07:12:52   

Hey everyone, I found that I was losing field information while doing a deep copy with the following code... a bleedin show stopper!!!!!:

    public static object CloneObject(object o)
    {
        SerializationHelper.Optimization = SerializationOptimization.Fast;
        SerializationHelper.PreserveObjectIDs = true;
        MemoryStream ms = new MemoryStream();
        BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone));
        bf.Serialize(ms, o);
        ms.Seek(0, SeekOrigin.Begin);
        object oOut = bf.Deserialize(ms);
        ms.Close();
        return oOut;
    }

Please note that if you use:

SerializationHelper.Optimization = SerializationOptimization.None;

Your data won't silently disappear! Eeek!

Andrew

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 27-May-2008 10:09:58   

Which LLBLGen runitme library version are you using?

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 28-May-2008 01:42:10   

File version is 2.5.07.1019

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 28-May-2008 10:43:30   

That's a relatively old version, would you please try using the latest available one?