Yarhl
Yarhl copied to clipboard
NodeContainerFormat transform methods dispose all the children
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.
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.