Skip to content

Commit 9bb9c2f

Browse files
committed
Bug fix: Registration of Singletons implementing IAsyncDisposable caused exception on shutdown when options.DisposeContainerWithServiceProvider was set to true. Fixes #4
1 parent bdea043 commit 9bb9c2f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/SimpleInjector.Integration.ServiceCollection/SimpleInjector.Integration.ServiceCollection.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</Description>
66
<AssemblyTitle>Simple Injector IServiceCollection Integration</AssemblyTitle>
77
<NeutralLanguage>en-US</NeutralLanguage>
8-
<VersionPrefix>5.0.1</VersionPrefix>
8+
<VersionPrefix>5.0.2</VersionPrefix>
99
<PackageReleaseNotes>https://github.com/simpleinjector/SimpleInjector.Integration.AspNetCore/releases/tag/5.0.0</PackageReleaseNotes>
1010
<AssemblyVersion>5.0.0.0</AssemblyVersion>
1111
<Authors>Simple Injector Contributors</Authors>

src/SimpleInjector.Integration.ServiceCollection/SimpleInjectorServiceCollectionExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,15 @@ private sealed class NullSimpleInjectorHostedService : IHostedService
648648
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
649649
}
650650

651-
private sealed class ContainerDisposeWrapper : IDisposable
651+
private sealed class ContainerDisposeWrapper : IDisposable, IAsyncDisposable
652652
{
653653
private readonly Container container;
654654

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

657657
public void Dispose() => this.container.Dispose();
658+
659+
public ValueTask DisposeAsync() => this.container.DisposeAsync();
658660
}
659661
}
660662
}

0 commit comments

Comments
 (0)