Hi @NALB, welcome to Microsoft Q&A. It sounds like you don't want to use JoinBlock. Then you probably need to wait for Test1Block and Test2Block to complete before passing their results to FinalBlock. You may need to create a TaskCompletionSource for each test block, and Wait for the results to complete before passing them to the FinalBlock. After the testblock is completed, pass the result to FinalBlock.
The following code is for reference only:
var Test1CompletionSource = new TaskCompletionSource<Test1>();
Test1Block.LinkTo(
new ActionBlock<Test1>(test1 =>
{
Test1CompletionSource.SetResult(test1);
})
);
await Task.WhenAll(Test1CompletionSource.Task, Test2CompletionSource.Task);
var data = Tuple.Create(Test1CompletionSource.Task.Result, Test2CompletionSource.Task.Result);
Console.WriteLine("{0} + {1} ", data.Item1, data.Item2 );
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.