Skip to content
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

FlexObject::Clone issues #108

Closed
drub0y opened this issue Feb 14, 2018 · 1 comment
Closed

FlexObject::Clone issues #108

drub0y opened this issue Feb 14, 2018 · 1 comment
Assignees
Labels
bug Indicates an unexpected problem or an unintended behavior.

Comments

@drub0y
Copy link
Contributor

drub0y commented Feb 14, 2018

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.

@cleemullins cleemullins added the bug Indicates an unexpected problem or an unintended behavior. label Feb 14, 2018
@cleemullins
Copy link
Contributor

FlexObject is depricated in #425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

No branches or pull requests

3 participants