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

Bug in ValueObject.Equals(obj)? #7477

Closed
ZUNNm1Xlwk opened this issue Sep 4, 2018 — with docs.microsoft.com · 2 comments · Fixed by #20235
Closed

Bug in ValueObject.Equals(obj)? #7477

ZUNNm1Xlwk opened this issue Sep 4, 2018 — with docs.microsoft.com · 2 comments · Fixed by #20235

Comments

Copy link

ZUNNm1Xlwk commented Sep 4, 2018

The current example implementation of the ValueObject.Equals(obj) method returns true for different objects in the following case:
The GetAtromicValues() of the current ValueObject returns 2 objects. The GetAtromicValues() of the ValueObject in the Equals parameter returns 1 object (equal to the first of the current ValueObject).
Nevertheless the count of objects is different the result of an Equals(...) returns true. This is odd.
I fixed this in my code by converting the GetAtomicValues() results to lists and comparing the count of these lists. This is of course not very high performance for huge atomic value collections...


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Copy link

I also ran into this bug in a project. It would be great to get the example updated. If the objects are identical with the exception of either object having exactly one additional atomic value, the objects will still be considered equal. Saving the result of the MoveNext() calls to a local variable can work around the problem and not require a ToList() on the GetAtomicValues() calls.

@mvelosop
Copy link
Contributor

mvelosop commented Oct 2, 2019

Hi @ZUNNm1Xlwk, @hackked, thanks for the feedback?

Well... no doubt you're both right!

Would some of you like to contribute a PR to eShopOnContainers repo to fix this?

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants