Warn when comma (,) is used in Property value of decimal type
See original GitHub issueIt appears that using comma (,) instead of decimal dot (.) is a common mistake.
When you write:
<cc:Test DoubleProperty="2,1">
Your expectation could be that TestProperty
would be assigned with value 2.1
wheres in reality the value would be 21
.
Problem is that numeric values in framework are treated as input in human language and not as in C#.
This may lead to hard to debug errors. I suggest that usage of comma in property values of numeric type is forbidden.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Force decimal point instead of comma in HTML5 number ...
As I understand the question is not about having a decimal separator. The question is about having '.' instead of ',' when the...
Read more >Localised number format and wrong input type for decimal ...
If I fix this myself by adding the attribute, the field remains completely empty because there is a comma instead of a point...
Read more >Model Binding Decimal Values | You've Been Haacked
That registers our model binder to only be applied to decimal types, which is good since we wouldn't want model binding to try...
Read more >binding type with decimal
A comma is seen as a separator and a dot as a decimal. so when I type "1234,5678" then the "attachValidationSuccess" event is...
Read more >Introduction to data types and field properties
In most cases, you should set the Format value to match the result type. Decimal Places. Specifies the number of decimal places to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree. We should exclude
AllowThousands
fromNumberStyles
when parsing numbers.I would just put there a simple error message
The value is not in a correct numeric format.
I don’t like these special validation cases.