-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] Fix
-int.ToString()
for locales (#7941)
Fixes: #7939 Context: dotnet/runtime#13363 Context: https://www.unicode.org/charts/PDF/U2200.pdf (page 2) Context: 5271f3e The LLVM IR generator (5271f3e) outputs a number of integer values, relying on the standard `int.ToString()` method to convert the value to a string. However, since .NET 6, this conversion is culture- sensitive and in certain cultures (list below) it will output the minus sign not as the "standard" ASCII \u002d character `-` but instead as something else (see complete list below for details). This breaks LLVM LLC: llc: environment.arm64-v8a.ll:554:7: error: expected value token stderr | i32 −1, ; apk_fd Fix the problem by using invariant culture when converting ***all*** integers and unknown objects to strings. The reason all of them are converted in this way is to avoid future changes to ICU and/or .NET to-string conversion that might affect the resulting integer format. Workaround: export `$LANG` to a locale that uses 0x2D `-` for negation, e.g. `LANG=C`. Locales/cultures affected by this issue are as follows: * ARABIC LETTER MARK + HYPHEN-MINUS `-` (\u061c \u002d): 26 cultures * ar * ar-001 * ar-BH * ar-DJ * ar-EG * ar-ER * ar-IL * ar-IQ * ar-JO * ar-KM * ar-KW * ar-LB * ar-MR * ar-OM * ar-PS * ar-QA * ar-SA * ar-SD * ar-SO * ar-SS * ar-SY * ar-TD * ar-YE * sd * sd-Arab * sd-Arab-PK * LEFT-TO-RIGHT MARK + HYPHEN-MINUS `-` (\u200e \u002d): 10 cultures * ar-AE * ar-DZ * ar-EH * ar-LY * ar-MA * ar-TN * he * he-IL * ur * ur-PK * RIGHT-TO-LEFT MARK + HYPHEN-MINUS `-` (\u200f \u002d): 3 cultures * ckb * ckb-IQ * ckb-IR * MINUS SIGN `−` (\u2212): 38 cultures * et * et-EE * eu * eu-ES * fi * fi-FI * fo * fo-DK * fo-FO * gsw * gsw-CH * gsw-FR * gsw-LI * hr * hr-BA * hr-HR * ksh * ksh-DE * lt * lt-LT * nb * nb-NO * nb-SJ * nn * nn-NO * no * rm * rm-CH * se * se-FI * se-NO * se-SE * sl * sl-SI * sv * sv-AX * sv-FI * sv-SE * LEFT-TO-RIGHT MARK + MINUS SIGN `−` (\u200e \u2212): 3 cultures * fa * fa-AF * fa-IR * LEFT-TO-RIGHT MARK + HYPHEN-MINUS + LEFT-TO-RIGHT MARK `-` (\u200e \u002d \u002e): 16 cultures * ks * ks-Arab * ks-Arab-IN * lrc * lrc-IQ * lrc-IR * mzn * mzn-IR * pa-Arab * pa-Arab-PK * ps * ps-AF * ps-PK * ur-IN * uz-Arab * uz-Arab-AF Update `BuildTest2.BuildBasicApplication()` to export `LANG=sv_SE.UTF-8` as part of the `dotnet build` command to test this scenario on macOS and Linux. (This change is ignored on Windows.)
- Loading branch information
1 parent
8d8b77f
commit a693bc5
Showing
8 changed files
with
80 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.