Exemple #1
0
        /// <summary>
        /// Gets the unexpected internal client error task sequence.
        /// </summary>
        /// <typeparam name="T">The result type.</typeparam>
        /// <param name="timeout">The timeout.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> for the unexpected error.</returns>
        private static TaskSequence GetUnexpectedInternalClientErrorTaskSequence <T>(TimeSpan timeout, Action <T> setResult)
        {
            // this fires to signal the the detection of a known astoria 1.0 bug.
            TraceHelper.WriteLine("Creating unexpected internal client error task sequence " + timeout);
            NullTaskReturn scratch;

            using (DelayTask timeoutTask = new DelayTask(timeout))
            {
                yield return(timeoutTask);

                scratch = timeoutTask.Result;
            }

            TraceHelper.WriteLine("Unexpected internal storage client error.");

            throw new StorageClientException(
                      StorageErrorCode.None,
                      "The operation has exceeded the default maximum time allowed for Windows Azure Table service operations.",
                      System.Net.HttpStatusCode.Unused,
                      null,
                      null)
                  {
                      HelpLink = "http://go.microsoft.com/fwlink/?LinkID=182765"
                  };
        }
Exemple #2
0
        /// <summary>
        /// Gets a timeout task sequence.
        /// </summary>
        /// <typeparam name="T">The type of the result.</typeparam>
        /// <param name="timeout">The timeout.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> that has been wrapped with a timeout if specified.</returns>
        private static TaskSequence GetTimeoutTaskSequence <T>(TimeSpan timeout, Action <T> setResult)
        {
            TraceHelper.WriteLine("Creating timeout task sequence " + timeout);
            NullTaskReturn scratch;

            using (DelayTask timeoutTask = new DelayTask(timeout))
            {
                yield return(timeoutTask);

                scratch = timeoutTask.Result;
            }

            throw ThrowTimeoutError(timeout);
        }