示例#1
0
        /// <summary>
        ///     Returns exception object for failed calls,
        ///     string.Empty for void return types,
        ///     and actual returned result for successful non-void calls.
        /// </summary>
        /// <returns></returns>
        private object GetReturnValueInternal(bool makeSecret)
        {
            this.RequirePostExecutionPhase();

            object retVal;

            if (this.InterceptedMedthodCallFailed)
            {
                retVal = this.MethodExecutionException;
            }
            else
            {
                if (this.InterceptedCallMetaData.IsStaticMethod)
                {
                    retVal = string.Empty;
                }
                else
                {
                    retVal = this.ReturnedValue;
                    if (makeSecret)
                    {
                        retVal = new SecretValueHash(retVal);
                    }
                }
            }
            return(retVal);
        }
        public string FormatReturnResult(object returnedResult, bool trueUi_FalseInternal)
        {
            if (this.IsReturnValueSecret)
            {
                returnedResult = new SecretValueHash(returnedResult);
            }

            Type retType = returnedResult == null ? this.MethodReturnType : returnedResult.GetType();

            string returnValueStr = InterceptedMethodParamMetadata.FormatParamValue(retType, returnedResult, trueUi_FalseInternal);

            return(returnValueStr);
        }
        private object SlowEvaluateFunctionParameter(object instanceObject)
        {
            if (this.CannotBeEvaluated)
            {
                return(null);
            }

            object val = VerySlowlyCompileAndInvoke(instanceObject, this.expression);

            if (this.ValueIsSecret)
            {
                val = new SecretValueHash(val);
            }

            return(val);
        }