can binary serialize, but deserialize fails

Posted by: jschultzco on 8 September 2017, 3:08 pm EST

  • Posted 8 September 2017, 3:08 pm EST


    i have a custom spread control with mods made for sheetview scrolling an image.  code was provided by FP support.  it lacks the ability to save the control & sheets (including the image) using the the standart save method.  i have been able to binary serialize the custom sheetview, but the deserialize fails with "The constructor to deserialize an object of type 'CustomBackground.ImageSheetView' was not found.  I added <Serializable()> to the Friend Class ImageSheetView Inherits SheetView which I assume allowed it to serialize.  since i can't load i don't know if everything was serialized.

    i've searched the forum but found nothing on binary serialization and some posts are so old that im not sure that the replies apply now.

    i posted here because support has not responded to my question.  i know FP monitors the forum so i'm hoping someone will reply.



  • Replied 8 September 2017, 3:08 pm EST


    It sounds like you just need to override GetObjectData and add the serialization constructor (also called "magic contructor") to the class:

        public ImageSheetView(SerializationInfo info, StreamingContext context)
            : base(info, context)
            BackgroundImage = (Image)info.GetValue("BackgroundImage", typeof(Image));
            BackgroundImageLayout = (ImageLayout)info.GetValue("BackgroundImageLayout", typeof(ImageLayout));
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
            base.GetObjectData(info, context);
            info.AddValue("BackgroundImage", BackgroundImage);
            info.AddValue("BackgroundImageLayout", BackgroundImageLayout);

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels