In C#, when you override a method, it is permitted to make the override async when the original method was not. This seems like poor form.
The example that brought me to this was this — I was brought in to assist with a load test problem. At around 500 concurrent users, the login process would break down in a redirect loop. IIS was logging exceptions with the message "An asynchronous module or handler completed while an asynchronous operation was still pending". Some searching led me to think that someone was abusing async void
, but my quick searches through the source could find nothing.
Sadly, I was searching for 'async\svoid' (regex search) when I should have been looking for something more like 'async\s[^T]' (assuming Task wasn't fully qualified… you get the point).
What I later found was async override void onActionExecuting(...
in a base controller. Clearly that had to be the problem, and it was. Fixing that up (making it synchronous for the moment) resolved the problem.
Back to the question: Why oh why can you mark an override as async when the calling code could never await it?
Task
.