Loading diagram from file throws error

I have been working on building an ERD type diagram with custom nodes and connections defined. I am able to save the diagram with the needed custom properties but when I try to open the save xml and load it to a diagram, I am getting a System.ArgumentException saying "Property set method not found. 

I have gone down to loading a single entity and still seeing the same exception. I have attached a sample project which is throwing the error. If you load the file in the Diagram folder, you will see the error. I am also attaching the stack trace from the exception.

Any direction you can provide would be extremely helpful.

Attachment: VsTestSyncFusion_cee88052.zip

1 Reply 1 reply marked as answer

PP Prakash Perumal Syncfusion Team April 12, 2021 10:33 AM UTC

Hi Stephen Shake,

 

Thanks for contacting Syncfusion support. 

 

We analyzed the provided sample and found that the exception is raised due to the following properties ‘TableBasePath’ & ‘TableBasePath’ doesn’t have set accessor. Since both the properties depends on the values of EntityNode’s Content property it is sufficient to serialize ‘Content’ property alone and you can remove the DataMember attributes for those properties.

 

Also we don’t serialize the Content and ContentTemplate properties of the NodeViewModel by default. So we have to use custom property to store the value of Content property while saving the diagram and on loading this value can be set back to desired property using ItemAddedEvent. And in order to serialize a new datatype, we have to add the new type in SfDiagram’s KnownTypes. Please find the ug documentation for serializing a custom class:

 

UG link: https://help.syncfusion.com/wpf/diagram/serialization#how-to-serialize-custom-properties

              https://help.syncfusion.com/wpf/diagram/serialization#how-to-serialize-a-custom-class

 

Regards,

Prakash P


Marked as answer
Loader.
Up arrow icon