davidfowl / AspNetCoreDiagnosticScenarios

This repository has examples of broken patterns in ASP.NET Core applications
7.69k stars 740 forks source link

Add: Best practice when you want to use async when disposing an IDisposable. #22

Closed nopara73 closed 5 years ago

nopara73 commented 5 years ago

I'm sorry, I don't have the answer, I'd just like to note that this is a common problem.

davidfowl commented 5 years ago

Great question! IAsyncDisposable is coming https://github.com/dotnet/corefx/issues/32640 but there's no good way of solving this now. I usually expose a DisposeAsync() method, instead of implementing IDisposable but then it means that callers can't do using statements.

nopara73 commented 5 years ago

That'll be wonderful. Should I close this issue or you'd prefer me to keep it alive?

davidfowl commented 5 years ago

Closing it is fine 😄