FakeGPS icon indicating copy to clipboard operation
FakeGPS copied to clipboard

"Input string was not in a correct format" error

Open xward opened this issue 8 years ago • 1 comments

This works :

$ ./FakeGPS -s 50,63
The following location has been set in the driver's registry settings:
Lat:    50
Long:   63

This doesn't :

$ ./FakeGPS -s 50.0,63
ZOMG, we got this error:
Input string was not in a correct format.
Send feedback plz!

So here is my feedback :)

After loking into the code in GeolocationHelper.cs I can see that the regexp went ok but it crash on the Convert.ToDouble method call throwing a FormatException.

After a few digging I found that : windows 10 parameter > Region >Additionnal Settings >Number > and changed the decimal symbol seprator to "." (from ",")

It fixed the problem, I am in French number format setting, and the lovely Convert.ToDouble method seems to use it.

Two different ideas to solve this (to avoid being dependant of locals) :

  • force convert.toDouble to use "." as seprator in any case.
  • use only integer, where 51.51786,-0.102216 become 5151786 102216 as arguments

xward avatar Jul 22 '16 17:07 xward

Well spotted, the fix should be to add InvariantCulture to Convert.ToDouble - I've pushed a fix, feel free to try it out and let me know.

juliankay avatar Jul 23 '16 20:07 juliankay