Binary serialization completely broken in 5.4 Selfservicing

Posts   
 
    
jspuij
User
Posts: 24
Joined: 22-Jan-2007
# Posted on: 22-Aug-2018 10:31:19   

In 5.4 selfservicing templates (entity.template) the deserialization constructor is empty:

        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected <[CurrentEntityName]>Entity(SerializationInfo info, StreamingContext context):base(info, context)
        {<[ UserCodeRegion "DeserializationConstructor" ]>
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END<[ EndUserCodeRegion ]>
        }

In addition GetObjectData for serialization does not exist anymore in entityInclude.template. This breaks binary serialization and deserialization. More worrysome user code in the User code region of "GetObjectData" is thrown away as the entire method vanishes on generation, including user code.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Aug-2018 13:30:03   

This has been fixed in the latest 5.4.3 hotfix, please download the 5.4.3 hotfix from the website, and make sure you regenerate the code AND use the latest runtime hotfix builds (e.g. the prerelease runtimes from nuget). It's not something to do with the templates, the code has been moved to the runtime, but a bug in the runtime caused empty collections not to be serialized causing problems.

Frans Bouma | Lead developer LLBLGen Pro
jspuij
User
Posts: 24
Joined: 22-Jan-2007
# Posted on: 22-Aug-2018 13:36:06   

And the code in the "User Code" regions? I've got a lot of entities, possibly with additional serialized data. Search code with regex and override GetObjectData, put it in a partial class?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Aug-2018 15:16:06   

Please see the docs: https://www.llblgen.com/Documentation/5.4/LLBLGen%20Pro%20RTF/migratingcode.htm#migrating-generated-code-from-v5.3-to-v5.4

In the entity classes there's no longer a GetObjectData() method in the generated code. This means the user code region in the method is no longer there. To work around this if you have code in that user code region, define an override of GetObjectData in a partial class of the entity and add the code there. (after calling the base method variant).

Frans Bouma | Lead developer LLBLGen Pro
jspuij
User
Posts: 24
Joined: 22-Jan-2007
# Posted on: 22-Aug-2018 15:17:51   

Thanks!