Open ismdiego opened 3 years ago
I experience the same problem. My culture locale is "de-DE" and fractioned values will fail to parse properly. @aloneguid would you please apply the PR and publish a new version?
@aloneguid Thanks, it works, this can be closed.
If you use a JSON store, you will face this problem with a config file like this:
If you execute this trivial code:
You will find out that
num1 == 0
(!!!!!). This is caused by a bug inGetStringValue
method inJsonFileConfigStore
which is usingToString()
to convert back the read value into a string. ThisToString()
takes Culture into account, and so it converts 2.5 to"2,5"
(notice the comma) in Cultures with that decimal separator (Spain, as in my case). Afterwards, theValueHandler
ParseValue
method fails in theTryParse
part because of that, and returns the default value (0 in this case).This is easily fixed in
JsonFileConfigStore
changing:to:
Can you please integrate this into the library? It is a safe change IMHO. And this is a really nasty bug...
As a temporary workaround, if you put:
Then the parser works well... and the value is converted to float