question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warn when comma (,) is used in Property value of decimal type

See original GitHub issue

It 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:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
djanosikcommented, Oct 7, 2017

I agree. We should exclude AllowThousands from NumberStyles when parsing numbers.

0reactions
tomashercegcommented, Oct 7, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found