The program should read the number from this file and convert it to double
.
Everything works fine everywhere except for one device. On my friend's laptop, the code throws an Input string was not in a correct format
exception.
At the same time, before converting, I specifically output a string that should be converted to double
and this string corresponds to the format.
What could be the problem?
Code:
using System;
using System.Net;
namespace Test
{
class Program
{
static void Main(string[] args)
{
double newVersion = 0;
try
{
string data = new WebClient().DownloadString("https://raw.githubusercontent.com/denisnumb/Keyboardpp/main/last_version");
data = data.Replace(".", ",");
Console.WriteLine(data);
newVersion = Convert.ToDouble(data);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine($"{newVersion}");
Console.ReadLine();
}
}
}
Output on my device:
0,92
0,92
Output on a friend's device:
0,92
Input string was not in a correct format
0