Serialization issue when using 5.3

Posts   
 
    
Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 17-Apr-2018 00:55:18   

I am currently upgrading from LLBLGen 4.2 to 5.3. I am using VB, Adapter model. FastSerialization.

When I add a new entity to an entitycollection in one of my graphs, I get a serialization error upon Deserialization. I am using .NET remoting. I did not get the same error in 4.2 and do not get the same error if I turn FastSerialization off. I have not changed my database structure at all, just regenerated using the new version.

The error is:

{"Index was outside the bounds of the array."}

in

at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadOneWayRelationInfo(IEntity2 entity) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadUnreferencedEntity(EntityBase2 entity, BitVector32 serializationFlags) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadCollection(IFastSerializableEntityCollection2 collection, BitVector32 serializationFlags) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadEntityMemberCollections(EntityBase2 entity) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadReferencedEntities(EntityBase2 rootEntity) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.Deserialize(EntityBase2 entity) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2..ctor(SerializationInfo info, StreamingContext context) at Coda.Entities.EntityClasses.CommonEntityBase..ctor(SerializationInfo info, StreamingContext context) at Coda.Entities.EntityClasses.EmployeeEntity..ctor(SerializationInfo info, StreamingContext context)

I don't get this error in any other circumstances (that I can tell), but one. Very odd. Without much detail (sorry), do you have any idea of what may be causing the issue. The only foreign keys in the entity are strings.

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Apr-2018 10:11:06   

And you're sure you're using 5.3 on both the client and the server?

Can you reproduce it locally by serializing / deserializing to /from a memory stream?

Frans Bouma | Lead developer LLBLGen Pro
Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 17-Apr-2018 23:37:23   

I am using 5.3 on both the client and server.

I can reproduce it locally. I am looking into the plumbing of the FastSerializer to see if I find anything interesting. It's returning an index of -1 on the following line in FastSerializer.WriteOneWayRelationInfo()

_writer.WriteOptimized(_referencedEntitiesLookup.IndexOf((EntityBase2)pair.Value));

The actual error occurs on deserialization because -1 isn't an index. What is interesting is that _referencedEntitiesLookup has the entity we are looking for, but with a different index.

I will keep digging.

Thanks for getting back to me

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Apr-2018 03:14:08   

Just to make sure: have you set the SerializationHelper.Optimization as stated here .NET Remoting / Fast Serialization

Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 18-Apr-2018 16:34:44   

I am using SD.LLBLGen.Pro.ORMSupportClasses.SerializationHelper.Optimization = SD.LLBLGen.Pro.ORMSupportClasses.SerializationOptimization.Fast on the client and server. Otherwise, just the defaults.

Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 18-Apr-2018 22:24:02   

I think this is a downstream issue caused by the behavior I'm seeing in this:

http://llblgen.com/tinyforum/Messages.aspx?ThreadID=24724

Perhaps when we run that to ground, this issue will go away.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Apr-2018 10:36:41   

I doubt it though, the internal code doesn't rely on onpropertychanged, so deserializing data should just rebuild the graph as it was serialized: it doesn't raise any events either as that would be way too slow. It simply re-instantiates the objects as they're found in the stream and sets references to the objects.

It's odd your serialization fails though, as it's code that is in production for many years in many systems and never had this reported before. Anyway, let's first get to the bottom of the other issue and we'll can then go back to this one simple_smile

Frans Bouma | Lead developer LLBLGen Pro