-
Notifications
You must be signed in to change notification settings - Fork 383
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
QuantityGenerator ignores ComparisonType in the obsolete Equals method #1394
Comments
Given that the operations with doubles introduce rounding errors along the way, we decided (in v5) that it would be best if we deprecated the standard equality contract (A.Equals(B)) in favor of comparing with tolerance. The good news is that I've been working on a solution to all these problems (no nuget available ATM). So I don't know how many warnings you've got after upgrading, but yeah- if you're not in a hurry, you might want to hold off on the "big-refactoring" until the official v6 release (there is currently a beta package, but that's no good either). |
Thanks for the quick response, I was reading through the various issues around comparisons and I understand the deprecation, but was there a reason to force If you changed this line:
to
Then it wouldn't change the behavior of existing (albeit problematic) comparisons, right? |
Oh I see what you mean, I think this must be a mistake 👍 :
@angularsen |
Looks like a mistake, anyone up for a pull request? |
…he obsolete Equals method
Easy fix, now let's see if that "breaks" someone's code 😄 |
fixes #1394 note that the error is also present in the v6 branch
Fix should be out shortly |
Wow, thanks for the quick work! |
We are in the process of migrating UnitsNet to the latest and found that some of our obsolete equals methods were failing. Inspecting the generated code shows that the comparison type is ignored.
UnitsNet/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
Line 872 in ce42aa8
Seems like the comparison class still supports it, any reason to not keep it backwards compatible?
UnitsNet/UnitsNet/Comparison.cs
Line 60 in ce42aa8
The text was updated successfully, but these errors were encountered: