-
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
[Bug]: Numeric comparison uses current culture #9757
Comments
Ah looks like this was reported in #5502 too but I'm not sure we should've closed the issue back then. |
Yeah I thought it looked familiar. But IIRC I didn't see any numeric parse that wasn't culture invariant. I remember fixing an unrelated regex that wasn't, though. |
It was #7499 and some are still missing invariant but not relevant to this. |
From @danmoseley in dotnet/runtime#98550 (comment)
This looks like the problem, as opposed to the string->int conversion that's actually reporting the problem (but appears to be culture neutral or it would understand the localized I agree on principle that everything should be culture-neutral. As usual, I'm worried about regressions--but that feels like something we could try behind a changewave. |
As @rainersigwald mentioned the problem in different approaches to converting string -> int and int -> string
The issue described earlier reproducible on unix following the steps. However I was not able to reproduce the issue on windows yet (except the simple code). msbuild/src/Build/Evaluation/Expander.cs Line 1417 in 0326fd7
Temp fix tested and verified it is working. |
Update to the previous comment: In case there Thread.CurrentThread.CurrentCulture = new CultureInfo("fi_FI"); is not set and the CultureInfo is set from the Windows settings there is no errors. |
Issue Description
We hit this in dotnet/runtime#98550 where a numeric comparison fails in the fi_FI culture because it uses
U+2212 : MINUS SIGN
instead of-
for negative numbers.I'm not sure whether this is intentional or a bug.
Steps to Reproduce
Expected Behavior
No error.
Actual Behavior
Note that the "−1" in the error message uses
U+2212 : MINUS SIGN
Analysis
No response
Versions & Configurations
Fails with both 8.0.100 and 9.0.100 P1 dotnet SDKs.
The text was updated successfully, but these errors were encountered: