here is the block of code that is catching the exception:
bool directionUp = Slope[0] <= Slope[1];
try
{
Print("================================== Slope Parameters ===================================");
for (int i = 0; i <= Slope.Count+1; i++)
{
Print(string.Format("Loop index : {0}", i));
Print(string.Format("Slope count -1 : {0}", Slope.Count -1));
if (directionUp && Slope[i + 1] < Slope[i])
{
peakIndexes[0] = i;
directionUp = false;
}
else if (!directionUp && Slope[i + 1] > Slope[i])
{
valleyIndexes[0] = i;
directionUp = true;
}
}
}
catch(Exception e)
{
Print(e.ToString());
}
}

Comment