Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic CompositeNode cannot be serialized (Read 3169 times)
moelski
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Feb 28th, 2011
CompositeNode cannot be serialized
Jun 2nd, 2011 at 5:31am
Print Post  
Hi !

Iīve changed our diagram nodes to compositenodes. As soon as I call the SaveToXML function I got an error:
Quote:
MindFusion.Diagramming.CompositeNode cannot be serialized because its class hasn't been registered for serialization. Use RegisterItemClass to do that


Why canīt Mindfusion write my composite nodes? They consist out of "normal" components.

So reply 5 in this posting: http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=130548485...
Thatīs what I use ...

Here is the complete error message:
System.InvalidOperationException was unhandled by user code
Message=MindFusion.Diagramming.CompositeNode cannot be serialized because its class hasn't been registered for serialization. Use RegisterItemClass to do that.
Source=MindFusion.Diagramming
StackTrace:
at MindFusion.Diagramming.XmlPersistContext.xcfee0917c3bf82cc(DiagramItem xccb63ca5f63dc470, XmlElement x1ea18269223b2a9c, String x121383aa64985888)
at MindFusion.Diagramming.Diagram.SaveToXml(XmlDocument document, Boolean includeUnalteredProperties)
at MindFusion.Diagramming.Diagram.SaveToXml(XmlDocument document)
at MindFusion.Diagramming.Diagram.SaveToXml(String fileName)
at LogView.V3.MainForm.MenuFile_Save_ItemClick(Object sender, ItemClickEventArgs e) in D:\Dev Priv\LogView V3 .net\SlyLog\MainForm.cs:line 1553
at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarItemLink.OnLinkClick()
at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraBars.Controls.DockedBarControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:


Greetz
   Dominik
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CompositeNode cannot be serialized
Reply #1 - Jun 2nd, 2011 at 7:16am
Print Post  
Hi,

There's no point in saving the full component hierarchy with every node, so CompositeNode does not implement that at this time. You will have to override the SaveToXml and LoadFromXml method to serialize only the values you need. For an example on how to do that, see ScriptedNode and its derived classes from the "Scripting" sample project.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
moelski
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Feb 28th, 2011
Re: CompositeNode cannot be serialized
Reply #2 - Jun 2nd, 2011 at 7:26am
Print Post  
Hi !

Where can I find the ScriptedNode Sample? I canīt see a project in the sample folder which contains this.

Quote:
There's no point in saving the full component hierarchy with every node

May I ask why?

Greetz
   Dominik
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CompositeNode cannot be serialized
Reply #3 - Jun 2nd, 2011 at 7:56am
Print Post  
Hi,

We added the Scripting sample with the v5.6.3 release.

We'll certainly implement optional full serialization some day, but don't see it as a big loss right now Smiley Our developers modeled this after WPF control templates, where your control's template describes the appearance for all instances of the control and might contain many components and property settings. There's no much value in saving the full template for every node and get huge xml files, when with a few lines of code you can save only the properties that contain the nodes' distinct data.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
moelski
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Feb 28th, 2011
Re: CompositeNode cannot be serialized
Reply #4 - Jun 13th, 2011 at 4:29am
Print Post  
Hi Stoyan,

just want to let you know that the "Scripting sample" is a great resource !

A great inspiration for dealing with composite nodes  Cheesy

Thx for that !
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: CompositeNode cannot be serialized
Reply #5 - Jun 13th, 2011 at 8:03am
Print Post  
You're welcome Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint