-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Numeric comparison: 9 < 10 but 16.9 > 16.10 #6054
Comments
But 16.9 is greater than 16.1... I'm more surprised by the four-part version being successfully recognized. I thought we had special property functions to deal with that, but apparently it sees them as versions anyway. I'd honestly say this is exactly what I'd expect. If you want to compare versions (and have 16.9 be less than 16.10), you can use the version comparison functions. |
What are these "version comparison functions"? |
See #4911 |
@rainersigwald Was this fixed or closed as won't fix? The PR that @Forgind linked to above doesn't address this. |
FWIW @Forgind's PR does provide a workaround that's acceptable. This issue just represents the unintuitive experience when you don't know about those property functions where msbuild recognizes integers and a.b.c.d versions automatically but doesn't recognize floating point numbers. So while IMO this would ideally be fixed, I'm not blocked and you can Won't Fix if you want. |
The thing is there's code to do floating point numbers:
So if it's not being used that's a problem. |
Issue Description
MSBuild seems to recognize integers when using inequality operators with string operands (which is good), but it fails to recognize floating point numbers as numeric, instead treating them like ordinary strings. This leads to unexpected evaluation of the conditionals.
As shown in the repro steps, MSBuild recognizes that
9 < 10
, but fails to recognize that16.9 < 16.10
. It does recognize 4-component versions though, recognizing that16.9.0.0 < 16.10.0.0
.Steps to Reproduce
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: