-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
short.Parse throws FormatException #111276
Comments
The error means you are trying to parse a number using incorrect format. Use overload, which accepts public static short Parse(string s, IFormatProvider? provider) short.Parse("-1", CultureInfo.CreateSpecificCulture("ar-SA")); // FormatException
short.Parse("-1", CultureInfo.CreateSpecificCulture("ar-SA")); // -1
short.Parse("-1", CultureInfo.InvariantCulture); // -1
short.Parse("-1", CultureInfo.InvariantCulture); // FormatException TLDR: Replace |
Tagging subscribers to this area: @dotnet/area-system-globalization |
Tagging subscribers to 'arch-wasm': @lewing |
Yeah, you're correct. The language is set to Hebrew. Didn't think about RTL issue. Thank you! |
Description
I have one of my users reporting an issue with our Blazor WASM app.
After investigating, we found the error being that
"-1"
cannot be parsed withshort.Parse
for him.He's the only user with that issue from about 200 users.
The stacktrace:
Reproduction Steps
Not reliably reproduceable on other machines. Here are the steps anyway:
{"-1":26}
Dictionary<string, int>
.{{"-1", 26}}
Dictionary<Id, int>
:Expected behavior
"-1"
should be parsed correctly to the Int16-1
.Actual behavior
System.FormatException
is thrown.Regression?
It still worked on 2025-01-03. It's not working any more since 2025-01-10.
The application is running the same version for both dates, the hosting Docker container wasn't even restarted.
Known Workarounds
For that one user, he can use another browser than Edge.
Edge works for other users.
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: