Yarhl icon indicating copy to clipboard operation
Yarhl copied to clipboard

NodeContainerFormat transform methods dispose all the children

Open Kaplas80 opened this issue 5 years ago • 1 comments

Describe the bug All the children are disposed after calling any Node transform method on a NodeContainerFormat.

To Reproduce Steps to reproduce the behavior: TransformNodeContainerProblem.zip I've attached a demo to see the issue. After the TransformWith call, all the children are disposed.

Expected behavior As the children have a new root node, they should remain undisposed.

Kaplas80 avatar Nov 20 '19 18:11 Kaplas80

It's a difficult case because the lifecycle (dispose) ownership of the children nodes is shared in three different objects: the parent Node, the source NodeContainerFormat and the new NodeContainerFormat.

As discussed internally, we have found a specific workaround / new strategy for your use-case: use the Tags property of the Nodes and remove the intermediate converter.

But we need to think about this mess of shared lifecycle with the children nodes because this use case of converter NodeContainerFormat -> NodeContainerFormat copying some of the original Nodes is broken and we may find more issues in the future.

pleonex avatar Nov 21 '19 12:11 pleonex