I have a situation where I am making an async
call to a method that returns and IDisposable
instance. For example:
HttpResponseMess
Yes, that should be fine.
In the first case, you're really saying:
In the second case, you're saying:
A using
statement in an async method is "odd" in that the Dispose
call may execute in a different thread to the one which acquired the resource (depending on synchronization context etc) but it will still happen... assuming the thing you're waiting for ever shows up or fail, of course. (Just like you won't end up calling Dispose
in non-async code if your using
statement contains a call to a method which never returns.)