protected override IEnumerator <IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .AsyncStep> GetAsyncSteps()
        {
            MessagingClientEtwProvider.TraceClient(() => {
            });
            if (!this.executeOnce)
            {
                while (this.ShouldGetEntityInfo(MessagingExceptionHelper.Unwrap(base.LastAsyncStepException as CommunicationException)))
                {
                    if (!RuntimeEntityDescriptionCache.TryGet(this.entityAddress, out this.runtimeEntityDescription))
                    {
                        this.request = this.CreateOrGetRequestMessage();
                        GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult     = this;
                        IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .BeginCall beginCall = (GetRuntimeEntityDescriptionAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.Channel.BeginRequest(thisPtr.request, t, c, s);
                        yield return(getRuntimeEntityDescriptionAsyncResult.CallAsync(beginCall, (GetRuntimeEntityDescriptionAsyncResult thisPtr, IAsyncResult a) => thisPtr.response = thisPtr.factory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));

                        if (base.LastAsyncStepException == null)
                        {
                            this.runtimeEntityDescription = GetRuntimeEntityDescriptionAsyncResult.BuildRuntimeEntityDescription(this.response);
                            RuntimeEntityDescriptionCache.AddOrUpdate(this.entityAddress, this.runtimeEntityDescription);
                            this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription;
                        }
                        else
                        {
                            if (!base.LastAsyncStepException.IsWrappedExceptionTransient())
                            {
                                yield return(base.CallAsyncSleep(Constants.GetRuntimeEntityDescriptionNonTransientSleepTimeout));
                            }
                            else
                            {
                                yield return(base.CallAsyncSleep(TimeSpan.FromSeconds((double)(this.attempt % 60)) + TimeSpan.FromMilliseconds((double)ConcurrentRandom.Next(1, 1000))));
                            }
                            GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult1 = this;
                            getRuntimeEntityDescriptionAsyncResult1.attempt = getRuntimeEntityDescriptionAsyncResult1.attempt + 1;
                        }
                    }
                    else
                    {
                        this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription;
                    }
                }
            }
            else
            {
                if (!RuntimeEntityDescriptionCache.TryGet(this.entityAddress, out this.runtimeEntityDescription))
                {
                    this.request = this.CreateOrGetRequestMessage();
                    GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult2     = this;
                    IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .BeginCall beginCall1 = (GetRuntimeEntityDescriptionAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.Channel.BeginRequest(thisPtr.request, t, c, s);
                    yield return(getRuntimeEntityDescriptionAsyncResult2.CallAsync(beginCall1, (GetRuntimeEntityDescriptionAsyncResult thisPtr, IAsyncResult a) => thisPtr.response = thisPtr.factory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer));

                    this.runtimeEntityDescription = GetRuntimeEntityDescriptionAsyncResult.BuildRuntimeEntityDescription(this.response);
                    RuntimeEntityDescriptionCache.AddOrUpdate(this.entityAddress, this.runtimeEntityDescription);
                }
                this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription;
            }
        }
 public void ScheduleGetRuntimeEntityDescription(TrackingContext trackingContext, MessageClientEntity clientEntity, string entityName, SbmpMessageCreator messageCreator)
 {
     Microsoft.ServiceBus.Messaging.RuntimeEntityDescription runtimeEntityDescription;
     if (!this.Settings.GatewayMode && clientEntity.RuntimeEntityDescription == null && !this.Settings.EnableRedirect && base.IsOpened)
     {
         string str = string.Concat(this.BaseAddress.AbsoluteUri, entityName);
         if (RuntimeEntityDescriptionCache.TryGet(str, out runtimeEntityDescription))
         {
             clientEntity.RuntimeEntityDescription = runtimeEntityDescription;
             return;
         }
         IOThreadScheduler.ScheduleCallbackNoFlow((object s) => (new GetRuntimeEntityDescriptionAsyncResult(trackingContext, clientEntity, str, this, messageCreator, false, Constants.GetRuntimeEntityDescriptionTimeout, null, null)).Start(), null);
     }
 }