You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When cloning individual properties or events with MemberCloner.Include(PropertyDefinition) or MemberCloner.Include(EventDefinition), the cloned members aren't added to the resulting MemberCloneResult.
It is important to note that the MemberCloner class itself does not inject any of the cloned members by itself.
Cloned properties and events are actually injected in their DeclaringType, but only if that type was explicitly cloned too using MemberCloner.Include(TypeDefinition) (or one of its variants) :
This behavior is inconsistent with what happens when cloning fields or methods, which are accessible in MemberCloneResult, and not automatically added to their declaring type.
When the declaring type isn't cloned, the only workaround to get back a reference to those cloned members is to register a custom IMemberClonerListener to the MemberCloner instance, implementing the OnClonedProperty(PropertyDefinition original, PropertyDefinition cloned) or OnClonedEvent(EventDefinition original, EventDefinition cloned) methods.
How To Reproduce
Clone individual properties or events with MemberCloner.Include()
Call MemberCloner.Clone()
Expected Behavior
The resulting MemberCloneResult has references to the original and cloned properties or events.
The cloned properties or events aren't automatically added to their declaring type when that type was also explicitly cloned.
Actual Behavior
The resulting MemberCloneResult doesn't have any reference to either the original or cloned properties or events.
The cloned properties or events are automatically added to their declaring type when that type was also explicitly cloned.
The text was updated successfully, but these errors were encountered:
AsmResolver Version
5.5.1.0
.NET Version
.net standard 2.0
Operating System
Windows
Describe the Bug
When cloning individual properties or events with
MemberCloner.Include(PropertyDefinition)
orMemberCloner.Include(EventDefinition)
, the cloned members aren't added to the resultingMemberCloneResult
.Additionally, and contrary to what the documentation says :
Cloned properties and events are actually injected in their
DeclaringType
, but only if that type was explicitly cloned too usingMemberCloner.Include(TypeDefinition)
(or one of its variants) :AsmResolver/src/AsmResolver.DotNet/Cloning/MemberCloner.Semantics.cs
Lines 13 to 19 in f70da79
AsmResolver/src/AsmResolver.DotNet/Cloning/MemberCloner.Semantics.cs
Lines 50 to 56 in f70da79
This behavior is inconsistent with what happens when cloning fields or methods, which are accessible in
MemberCloneResult
, and not automatically added to their declaring type.When the declaring type isn't cloned, the only workaround to get back a reference to those cloned members is to register a custom
IMemberClonerListener
to theMemberCloner
instance, implementing theOnClonedProperty(PropertyDefinition original, PropertyDefinition cloned)
orOnClonedEvent(EventDefinition original, EventDefinition cloned)
methods.How To Reproduce
MemberCloner.Include()
MemberCloner.Clone()
Expected Behavior
MemberCloneResult
has references to the original and cloned properties or events.Actual Behavior
MemberCloneResult
doesn't have any reference to either the original or cloned properties or events.The text was updated successfully, but these errors were encountered: