/// <returns>true if any errors are found at this level or below</returns>
        /// Guard against a mistake in the tree that causes infinite recursion.
        private static bool GetErrors2(FunctionCalc fnCalc, ref IList <FunCalcError> lowestErrors, ref IList <FunCalcError> allErrors, string NumberFormat, IList <SingleResult> callStack)
        {
            bool         bRet         = false;
            FunCalcError funCalcError = null;

            // ----------------------
            if (fnCalc.GetCalcStatus() == CalcStatus.Bad)
            {
                funCalcError = new FunCalcError(fnCalc.CalcQuantity?.Message, fnCalc);
                allErrors.Add(funCalcError);
                bRet = true;
            }

            // ----------------------
            bool bFoundLower = false;

            foreach (SingleResult input in fnCalc.Inputs)
            {
                bool bFoundMore = false;
                if (input is FunctionCalc)
                {
                    if (callStack.IndexOf(input) >= 0)
                    {
                        throw new UnspecifiedException("Infinite recursion in Expression Tree");
                    }
                    callStack.Add(input);
                    bFoundMore = GetErrors2(((FunctionCalc)input), ref lowestErrors, ref allErrors, NumberFormat, callStack);
                    callStack.Remove(input);
                }
                else
                {
                    bFoundMore = GetErrors3(input, ref lowestErrors, ref allErrors, NumberFormat);
                }

                if (bFoundMore)
                {
                    bFoundLower = true;
                }
            }

            // ----------------------
            if (bFoundLower)
            {
                bRet = true;
            }
            else if (funCalcError != null)
            {
                lowestErrors.Add(funCalcError);
            }

            return(bRet);
        }
        private static bool GetErrors3(SingleResult input, ref IList <FunCalcError> lowestErrors, ref IList <FunCalcError> allErrors, string NumberFormat)
        {
            bool bRet = false;

            if (input?.CalcQuantity?.CalcStatus == CalcStatus.Bad)
            {
                FunCalcError funCalcError = new FunCalcError(input?.CalcQuantity?.Message, input);
                allErrors.Add(funCalcError);
                lowestErrors.Add(funCalcError);
                bRet = true;
            }

            return(bRet);
        }