WPF Chart Hangs in Infinite Loop
Posted: Wed Nov 26, 2008 6:16 pm
I encountered an infinite loop in the following code. It is taken from the Axis class.
do
{
tmp = iRange / tmpResult;
if (Math.Abs(tmp) < int.MaxValue)
{
tempNumLabels = Utils.Round(tmp);
if (tempNumLabels > maxNumLabels)
if (Logarithmic)
tmpResult = tmpResult * LogarithmicBase;
else
tmpResult = NextStep(tmpResult);
}
else
if (Logarithmic)
tmpResult = tmpResult * LogarithmicBase;
else
tmpResult = NextStep(tmpResult);
inf = double.IsInfinity(tmpResult);
} while ((tempNumLabels > maxNumLabels) && (tmpResult <= iRange) && (!inf));
I did not spend a lot of time debugging it. Please resolve.
do
{
tmp = iRange / tmpResult;
if (Math.Abs(tmp) < int.MaxValue)
{
tempNumLabels = Utils.Round(tmp);
if (tempNumLabels > maxNumLabels)
if (Logarithmic)
tmpResult = tmpResult * LogarithmicBase;
else
tmpResult = NextStep(tmpResult);
}
else
if (Logarithmic)
tmpResult = tmpResult * LogarithmicBase;
else
tmpResult = NextStep(tmpResult);
inf = double.IsInfinity(tmpResult);
} while ((tempNumLabels > maxNumLabels) && (tmpResult <= iRange) && (!inf));
I did not spend a lot of time debugging it. Please resolve.