/// <summary> /// Attempts to transition the underlying Task<TResult> into the Faulted state and binds it to a specified exception. /// </summary> /// <param name="exception"></param> /// <returns></returns> public bool TrySetException(Exception exception) { System.Threading.Tasks.AggregateException exception2 = exception as System.Threading.Tasks.AggregateException; if (exception2 != null) { return(this.Task.TrySetException(exception2)); } UnityTask <T> task = this.Task; Exception[] innerExceptions = new Exception[] { exception }; return(task.TrySetException(new System.Threading.Tasks.AggregateException(innerExceptions).Flatten())); }