-
Notifications
You must be signed in to change notification settings - Fork 2.7k
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Copy events modify properties of Copy/Original objects as if they were the same instance #5513
Comments
Thanks for reporting @tomwidel - I'll need to discuss with some people at HQ to see what the expected behavior is and why, it sounds like a bug indeed but maybe I'm missing something. Have you looked into the sender object as well to see if that contains a usable copy instead? Note: I'm not familiar with the code, so I might be saying silly things now.. ;-) I'll let you know when I get some answers from my colleagues! |
@nul800sebastiaan Hello, is there any update on this? In version 8.5.2 this bug still exists. As an alternative to make it work someone can re-fetch the node by using Content Service.
|
The [DoNotClone] is meant to be there, there's a note in the code comments:
The actual cloning of the properties manually takes place in the override of That said there's definitely an issue here. I've created a unit test to work with. Although we could 'fix' this by re-fetching the node it's just covering up another issue which I think is actually to do with the cloning of property values within the property collection. I'll see what i can find. |
Fixed in this PR #7795 Please see notes there... this is actually quite a large bug that could have unknown larger consequences. |
Thanks Shannon for digging in. This is fixed for v8.7.0. |
Using Umbraco v8.0.2
Copied/Copying events modify properties of Copy/Original objects as if they were the same instance.
The issue occurs during handling of ContentService.Copied and/or ContentService.Copying events.
Assigning a value to either e.Copy or e.Original object via SetValue() method updates values of both objects as if they were the same instance.
I believe the issue is caused by the Umbraco.Core.Models.ContentBase.Properties property being marked with DoNotCloneAttribute.
During DeepCloneWithResetIdentities() method called internally by Copy the same Umbraco.Core.Models.ContentBase.Properties instance is shared by both e.Copy and e.Original.
Reproduction
Steps to reproduce
Expected result
e.Copy.GetValue("PROPERTY_NAME") should be "1"
Actual result
e.Copy.GetValue("PROPERTY_NAME") is "2"
The text was updated successfully, but these errors were encountered: