I have this construct in my main()
, which creates
var tasks = new List<Task>();
var t = Task.Factory.StartNew(
async () =>
{
Foo.Fim();
await Foo.DoBar();
});
//DoBar not completed
t.Wait();
//Foo.Fim() done, Foo.DoBar should be but isn't
However, when I .Wait
for t, it won't wait for the call to DoBar()
to complete.
How do I get it to actually wait?
Task.StartNew(async() => ...)
) and which explains what's going on