System.Collections.Async.AsyncEnumerator.Yield.SetFailed(System.Exception)

Here are the examples of the csharp api class System.Collections.Async.AsyncEnumerator.Yield.SetFailed(System.Exception) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: AsyncEnumerable
Source File: AsyncEnumerator.cs
private static void OnEnumerationComplete(Task task, object state)
        {
            var enumerator = (AsyncEnumeratorWithState<TItem, TState>)state;

            // When en enumeration is complete, there is nothing to dispose.
            GC.SuppressFinalize(enumerator);

            if (task.IsFaulted)
            {
                if (task.Exception.GetBaseException() is AsyncEnumerationCanceledException)
                {
                    enumerator._yield.SetCanceled();
                }
                else
                {
                    enumerator._yield.SetFailed(task.Exception);
                }
            }
            else if (task.IsCanceled)
            {
                enumerator._yield.SetCanceled();
            }
            else
            {
                enumerator._yield.SetComplete();
            }
        }