DryIoc
DryIoc copied to clipboard
IAsyncDisposable is not being called after container.Dispose
I haven't found that IAsyncDisposable is actually supported and thus not being called. I'm using implementation of IHostedService, so I can run something like
IServiceProvider _services; // injected and stored as a field
public async Task StopAsync(CancellationToken cancellationToken)
{
foreach (var disposable in _services.GetServices<IAsyncDisposable>())
await disposable.DisposeAsync();
}
but it is still just a workaround. Do you have a recommended approach how to deal with it? One option that comes to my mind is implement also IDisposable that recalls DisposeAsync but it covers only my implementations and I have to (should) dispose 3rd party code also that is registered too.
IAsyncDisposable is not yet supported. I am open for PRs.
This should probably need to be added to Container and to Scope.
We need to ensure that the task machinery is not affecting performance of the old Dispose implementations, especially the one for the Scope.
The inspiration from the LightInject https://github.com/seesharper/LightInject/pull/573/files
Hi, We're using the Prism WPF library for our application. Prism uses DryLoc. Any ETA on when we can expect support for IAsyncDisposable in DryLoc?
@jeroenwalter When time permits. Hope that it will be soon. This is the current feature I am working on.