Пример #1
0
        public object InvokeAction(object[] arguments, ITestTracer testTracer, out TimeSpan duration)
        {
            try
            {
                object    result;
                Stopwatch stopwatch = new Stopwatch();
                using (CreateCultureInfoScope())
                {
                    stopwatch.Start();
                    result = BindingAction.DynamicInvoke(arguments);
                    stopwatch.Stop();
                }

                if (RuntimeConfiguration.Current.TraceTimings && stopwatch.Elapsed >= RuntimeConfiguration.Current.MinTracedDuration)
                {
                    testTracer.TraceDuration(stopwatch.Elapsed, MethodInfo, arguments);
                }

                duration = stopwatch.Elapsed;
                return(result);
            }
            catch (ArgumentException ex)
            {
                throw errorProvider.GetCallError(MethodInfo, ex);
            }
            catch (TargetInvocationException invEx)
            {
                var ex = invEx.InnerException;
                ex = ex.PreserveStackTrace(errorProvider.GetMethodText(MethodInfo));
                throw ex;
            }
        }