-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"The node already has a parent." exception when setting JsonNode in Workflows ForEach Task #16846
Comments
I assume that's a technical limitation to STJ and you just can't copy these nodes. |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
Yes, I have already dealt with this issue, so do I need to submit a pull reset now? |
@zl2fxy if you think there is a product defect (a bug) somewhere in OC feel free to open one. It didn't seem like there is one to me, but maybe it will clear it out by seeing a PR. |
It seems that this issue didn't really move for quite a while despite us asking the author for further feedback. Is this something you'd like to revisit any time soon or should we close? Please reply. |
Title: System.InvalidOperationException: The node already has a parent. when setting JsonNode in OrchardCore Workflows
Description: I encountered a System.InvalidOperationException: The node already has a parent. when working with JsonNode in OrchardCore workflows. The error occurs when setting a JsonNode as the current value in a ForEachTask activity. It seems that the same JsonNode is being assigned to multiple parents, which causes the exception.
Error Message:
Steps to Reproduce:
Create a workflow in OrchardCore that includes a ForEachTask activity.
Iterate over a collection of JsonNode objects.
Set a JsonNode object as the current value of the task in each iteration.
The exception is thrown because the JsonNode has already been assigned to a parent.
Expected Behavior: There should be no exception when setting a JsonNode in each iteration of the ForEachTask. Either JsonNode should be cloned or detached from its current parent before being reassigned.
Actual Behavior: An exception is thrown because JsonNode is being reused and assigned to multiple parents.
Possible Solutions:
Clone the JsonNode using DeepClone() before assigning it to avoid parent conflicts.
Remove the JsonNode from its current parent before reassigning it.
Environment:
OrchardCore version: 2.0
.NET version: .net8.0
Operating System: windows
The text was updated successfully, but these errors were encountered: