From 933a2f5a1d0740c8ccc62dcd9e8222a5bbab0333 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 18 Apr 2016 22:47:28 -0700 Subject: [PATCH] Don't dispose the server anymore, the container does it --- src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs | 1 - test/Microsoft.AspNetCore.Hosting.Tests/WebHostTests.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs b/src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs index f71865d5c4..0dbc256180 100644 --- a/src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs +++ b/src/Microsoft.AspNetCore.Hosting/Internal/WebHost.cs @@ -212,7 +212,6 @@ namespace Microsoft.AspNetCore.Hosting.Internal { _logger?.Shutdown(); _applicationLifetime.StopApplication(); - Server?.Dispose(); (_applicationServices as IDisposable)?.Dispose(); _applicationLifetime.NotifyStopped(); } diff --git a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostTests.cs b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostTests.cs index 1ee6764235..c311083234 100644 --- a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostTests.cs +++ b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostTests.cs @@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Hosting host.Dispose(); - Assert.Equal(2, _startInstances[0].DisposeCalls); // Once as the server, once from the DI Container + Assert.Equal(1, _startInstances[0].DisposeCalls); } [Fact] @@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.Hosting // Wait on the host to shutdown lifetime.ApplicationStopped.WaitHandle.WaitOne(); - Assert.Equal(2, _startInstances[0].DisposeCalls); // Once as the server, once from the DI Container + Assert.Equal(1, _startInstances[0].DisposeCalls); } [Fact]