public virtual TResult ExecuteAction()

in edge-modules/functions/binding/src/Microsoft.Azure.WebJobs.Extensions.EdgeHub/transientFaultHandling/RetryPolicy.cs [136:185]


        public virtual TResult ExecuteAction<TResult>(Func<TResult> func)
        {
            Guard.ArgumentNotNull(func, "func");
            int num = 0;
            ShouldRetry shouldRetry = this.RetryStrategy.GetShouldRetry();
            TResult result;
            while (true)
            {
                Exception ex;
                TimeSpan zero;
                try
                {
                    result = func();
                    break;
                }
#pragma warning disable CS0618 // Type or member is obsolete
                catch (RetryLimitExceededException ex2)
#pragma warning restore CS0618 // Type or member is obsolete
                {
                    if (ex2.InnerException != null)
                    {
                        throw ex2.InnerException;
                    }

                    result = default(TResult);
                    break;
                }
                catch (Exception ex3)
                {
                    ex = ex3;
                    if (!this.ErrorDetectionStrategy.IsTransient(ex) || !shouldRetry(num++, ex, out zero))
                    {
                        throw;
                    }
                }

                if (zero.TotalMilliseconds < 0.0)
                {
                    zero = TimeSpan.Zero;
                }

                this.OnRetrying(num, ex, zero);
                if (num > 1 || !this.RetryStrategy.FastFirstRetry)
                {
                    Task.Delay(zero).Wait();
                }
            }

            return result;
        }