Skip to content

Commit

Permalink
Bug fix: Registration of Singletons implementing IAsyncDisposable cau…
Browse files Browse the repository at this point in the history
…sed exception on shutdown when options.DisposeContainerWithServiceProvider was set to true. Fixes #4
  • Loading branch information
dotnetjunkie committed Oct 25, 2020
1 parent bdea043 commit 9bb9c2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</Description>
<AssemblyTitle>Simple Injector IServiceCollection Integration</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>5.0.1</VersionPrefix>
<VersionPrefix>5.0.2</VersionPrefix>
<PackageReleaseNotes>https://github.com/simpleinjector/SimpleInjector.Integration.AspNetCore/releases/tag/5.0.0</PackageReleaseNotes>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<Authors>Simple Injector Contributors</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,15 @@ private sealed class NullSimpleInjectorHostedService : IHostedService
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}

private sealed class ContainerDisposeWrapper : IDisposable
private sealed class ContainerDisposeWrapper : IDisposable, IAsyncDisposable
{
private readonly Container container;

public ContainerDisposeWrapper(Container container) => this.container = container;

public void Dispose() => this.container.Dispose();

public ValueTask DisposeAsync() => this.container.DisposeAsync();
}
}
}

0 comments on commit 9bb9c2f

Please sign in to comment.