[Blazor] InputSelect and problematic use of CultureInfo.CurrentCulture
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
Looking at https://github.com/dotnet/aspnetcore/pull/65222 I saw that we are using CultureInfo.CurrentCulture for the parsing.
I think that is a subtle bug we introduced as part of #23415.
If we look at the previous code from `InputSelect`, the check was behind a `typeof(TValue).IsEnum`. Ideally for InputSelect, we should use CultureInfo.InvariantCulture for parsing, which is what we use elsewhere.
Then you'd use `value.ToString(CultureInfo.CurrentCulture) />` if the current culture wasn't compatible with the invariant culture.
This didn't matter because we used it for Enums and primitive types that weren't affected by it, but it will affect other types like integers and floating-point values.
Contributor guide
Research direction
Start with the current InputSelect implementation and compare its parsing with the previous code referenced in #23415, using PR #65222 for context. Verify behavior for integer and floating-point values under differing cultures, and consider the issue complete when InputSelect parsing is culture-independent as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100