So here\'s deleagte and event
public delegate Task SomeEventHandler(SomeEventArgs e);
...
public event SomeEventHandler OnSomething;
Subscri
The problem here is that multiple instances of SomeEventHandler are running hence there are multiple Task values being created. The await call is only running on one of them hence it's somewhat up to chance as to whether or not it's theDoSomething method that ends up being awaited.
To fix this you will need to await on every Task value that is created
if (this.OnSomething != null) {
foreach (var d in this.OnSomething.GetInvocationList().Cast<SomeEventHandler>()) {
await d(args);
}
]