So this may sounds like a silly question but I’m curious.
Given a handler with code that looks like this
List<Task> tasks = new List<Task>();
// Some code
tasks.Add(context.Send(new someNewMessage());
// Other code in handler
tasks.Add(context.Send(new someDifferentMessage());
await Task.WhenAll(tasks);
I understand messages are batched and sent at the end of the handler unless marked for ImmediateDispatch anyway. I was just curious about if there was anything that could go wrong when awaiting all of the tasks at the end? I understand this is not what is recommended from any of the docs but just curious if any consequences of doing this jump out at you.