Exemplo n.º 1
0
        public void SetException(Exception exception)
        {
            if (!IsCompleted)
            {
                IsCompleted = true;

                if (!CompletionSource.Task.IsCompleted)
                {
                    CompletionSource.SetException(exception);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the <typeparamref name="TException"/> exception that invocations will receive.
 /// </summary>
 /// <param name="exception"></param>
 public void SetException <TException>(TException exception)
     where TException : Exception
 => CompletionSource.SetException(exception);