Adding a new property while serializing the SfDiagram is not supported.

Hello,


I am saving SfDiagram as below. When I reload after saving, it loads without any problems. But if I add a new variable to my inside classes, I get an error that that variable doesn't exist. If a new variable is added in the future, will I not be able to load old saved xaml files in my class?

 if (dialog.ShowDialog() == true)

            {

                using (Stream strC = File.Open(dialog.FileName, FileMode.CreateNew))

                {

                    Diagram.Save(strC);

                }

            }


Error : 

The 'Element' '_description' is not expected from the Controls.Properties' namespace. Expected element: '_test'.'


If I use the following command, I get an error like this.

Diagram.Upgrade(myStream);

Error : System.NotSupportedException: 'Stream does not support writing.'


6 Replies

ÖZ Özgür May 25, 2023 12:34 PM UTC

I added an example. There is trial.xaml in the debug file. This file is a version saved before adding the "Deneme" variable in the TextControlProperties class in the Project. If you delete the "Deneme" variable from the project, the installation will be fine. But when a new variable is added in the class, you will get a loading error.


Attachment: WpfApp9_c4198c79.rar


ÖZ Özgür replied to Özgür May 25, 2023 01:51 PM UTC

If I add [OptionalField] attributes to the variable I can load it without a problem. Do I have to give this attribute to all variables? Is there an alternative solution?



KR Karkuvel Rajan Shanmugavel Syncfusion Team May 29, 2023 03:56 AM UTC

Hi Ozgur,


Currently, we are trying to find other alternative solution for your request. We will update you with more details on May 30, 2023.


Regards,

Karkuvel Rajan S



KR Karkuvel Rajan Shanmugavel Syncfusion Team May 31, 2023 12:29 PM UTC

Hi Ozgur,


Currently, we don’t have any direct solution for your requirement. Please use the same procedure of adding [OptionalField] attributes to the newly added properties to overcome the issue. In future, if we find any solution, we will share it with you.


Regards,

Karkuvel Rajan S



ÖZ Özgür replied to Karkuvel Rajan Shanmugavel June 1, 2023 05:34 AM UTC

Thank you for the response. 



PR Preethi Rajakandham Syncfusion Team June 2, 2023 10:03 AM UTC

Hi Ozgur,

You're welcome. We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help.

Regards,

Preethi R


Loader.
Up arrow icon