//Linkd MY block to OHTER dataflow protected void LinkBlockToFlow <T>(ISourceBlock <T> block, IDataflow <T> otherDataflow, Predicate <T> predicate = null) { if (!IsMyChild(block)) { throw new InvalidOperationException(string.Format("{0} Cannot link block to flow as the output block is not my child.", this.FullName)); } if (predicate == null) { block.LinkTo(otherDataflow.InputBlock); } else { block.LinkTo(otherDataflow.InputBlock, predicate); } otherDataflow.RegisterDependency(this); //Make sure other dataflow also fails me otherDataflow.Completion.ContinueWith(otherTask => { if (this.Completion.IsCompleted) { return; } if (otherTask.IsFaulted) { LogHelper.Logger.InfoFormat("{0} Downstream dataflow faulted before I am done. Fault myself.", this.FullName); this.Fault(new LinkedDataflowFailedException()); } else if (otherTask.IsCanceled) { LogHelper.Logger.InfoFormat("{0} Downstream dataflow canceled before I am done. Cancel myself.", this.FullName); this.Fault(new LinkedDataflowCanceledException()); } }); }