vlingo-net / xoom-net-common

These are just a few common tools shared across various vlingo .NET projects.
Mozilla Public License 2.0
7 stars 9 forks source link

Await() doesn't hold on before nested Completes computes the Outcome #63

Open tjaskula opened 3 years ago

tjaskula commented 3 years ago

There is a situation in xoom-net-symbio tests where Await() is called on the top parent ICompletes expression but is resolved before the nested one computes it's result. Consider this line

_journal.JournalReader("test").AndThenTo(reader => reader.StreamAll()).Await()

Once the outcome of AndThenTo is computed (reader in that case) the Await() unlocks where it should wait for the result of StreamAll(). There workaround is to split the lines like the following:

var reader = _journal.JournalReader("test").Await();
var all = reader?.StreamAll().Await();

It should be fixed