Weird copy / paste problem

I have a GraphView with copy/pastable GoGeneralNodes (InfoNode8 and ClassDiagramNode specifically). One weird thing that happens.



- I have given the Nodes a variable which is List<> of references to other forms.



- The Nodes can no longer be Pasted. (the Paste toolbar button is lit up however, so it does get copied).



- If I remove the List of references from the Node (or just leave them null) the Nodes go back to being paste-able.



I have overridden GoGeneralNode.CopyChildren, in which I simply initialize the lists to empty when copied.



Basically, if I add a generic container variable to a Node it becomes un-pastable in a GraphView. Any ideas why?

Are you calling base.CopyChildren as well in your override?

Yes. I call base.CopyChildren before doing any custom stuff in the overidden CopyChildren function.

One update that might help figure this out:



- usually when you copy/paste Nodes into a GraphView, the stuff you pasted is automatically selected (GraphView.Selection)



- when you copy/paste a Node that has a non-null List<> as a member variable, the GraphView.Selection is empty after the Edit.Paste() action

Ok I figured out the problem:



- The List<> variables in the un-pastable Node class are lists of non-serializable objects



- In the Node class I marked the List<> variables as [NonSerialized]



- Now the Nodes copy/paste as usual



Not sure why serialization affects copy/paste?

because we serialize the selection to the clipboard.