I just found a bug trying to save the value 0.0001 to a double variable in Settings.
Below I simplified the steps for you to reproduce this bug. But in my case, I used a Entry to input a value and parsed it to a double, lets call it parsedDouble. Then I tried to save the result of parsedDouble / 100 to a Settings.MinRate variable, resulting in a -Infinity.
Bug Information
Version Number of Plugin: 3.0.1
Device Tested On: Moto Maxx (Android 7.1)
Simulator Tested On: none
Version of VS: 15.3.5
Version of Xamarin: 4.7.9.45
Versions of other things you are using:
Steps to reproduce the Behavior
have this variable configured like this in Settings.cs file:
private const string txt_MinRateyKey = "txt_MinRate_Key";
private static readonly double txt_MinRateDefault = 0.0;
public static double txt_MinRate
{
get => AppSettings.GetValueOrDefault(txt_MinRateyKey, txt_MinRateDefault);
set => AppSettings.AddOrUpdateValue(txt_MinRateyKey, value);
}
then on a page try doing this:
double i = 0.001;
Settings.txt_MinRate = i / 100;
Expected Behavior
Settings.txt_MinRate to have the value of 0.00001
Actual Behavior
Settings.txt_MinRate has the value of negative infinity.
Code snippet
my actual code:
if (double.TryParse(txt_MinRate.Text, out double i))
{
if (i < 0.0 || i > 6.0)
{
if (i > 6.0)
{
DisplayAlert("Invalid input", "6% is the maximum rate that Poloniex allows.", "OK");
txt_MinRate.Text = "6.0";
}
else if (i < 0.0)
{
DisplayAlert("Invalid input", "Don't worry. There will never be a negative rate", "OH Good");
txt_MinRate.Text = "0.0";
}
}
else
{
Settings.txt_MinRate = i / 100;
}
if (i == 0)
txt_MinRate.Text = "";
}
Hi!
I just found a bug trying to save the value 0.0001 to a double variable in Settings.
Below I simplified the steps for you to reproduce this bug. But in my case, I used a Entry to input a value and parsed it to a double, lets call it parsedDouble. Then I tried to save the result of parsedDouble / 100 to a Settings.MinRate variable, resulting in a -Infinity.
Bug Information
Version Number of Plugin: 3.0.1 Device Tested On: Moto Maxx (Android 7.1) Simulator Tested On: none Version of VS: 15.3.5 Version of Xamarin: 4.7.9.45 Versions of other things you are using:
Steps to reproduce the Behavior
have this variable configured like this in Settings.cs file:
then on a page try doing this:
double i = 0.001; Settings.txt_MinRate = i / 100;
Expected Behavior
Settings.txt_MinRate to have the value of 0.00001
Actual Behavior
Settings.txt_MinRate has the value of negative infinity.
Code snippet
my actual code:
Screenshots