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
First, FlexObject::Clone actually deserializes to a more specific subclass of StoreItem which could lead to some very strange behavior. A couple of scenarios that this would be produce unexpected results for:
You're just cloning a "raw" FlexObject instance... why would you get back a StoreItem?
You're cloning a subclass of StoreItem, maybe a FooItem... one would expect an instance of FooItem to come back, not just a StoreItem.
At bare minimum, the FlexObject::Clone implementation should produce an instance of the exact type that is being cloned (e.g. use this.GetType()).
Bigger picture, implementing ICloneable in .NET is generally frowned upon these days for many reasons, this being one of them. Therefore, I strongly suggest reconsidering whether the Bot Framework support any type of cloning at all. As a .NET user, I don't expect it because I am already aware of this can of worms. Guidance can always be given to those who might find a need for cloning to implement it themselves.
The text was updated successfully, but these errors were encountered:
First,
FlexObject::Clone
actually deserializes to a more specific subclass ofStoreItem
which could lead to some very strange behavior. A couple of scenarios that this would be produce unexpected results for:FlexObject
instance... why would you get back aStoreItem
?StoreItem
, maybe aFooItem
... one would expect an instance ofFooItem
to come back, not just aStoreItem
.At bare minimum, the
FlexObject::Clone
implementation should produce an instance of the exact type that is being cloned (e.g. usethis.GetType()
).Bigger picture, implementing
ICloneable
in .NET is generally frowned upon these days for many reasons, this being one of them. Therefore, I strongly suggest reconsidering whether the Bot Framework support any type of cloning at all. As a .NET user, I don't expect it because I am already aware of this can of worms. Guidance can always be given to those who might find a need for cloning to implement it themselves.The text was updated successfully, but these errors were encountered: