diff --git a/src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs b/src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs index 3808b6144b..f9f4ae8c8e 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs @@ -14,6 +14,11 @@ namespace Microsoft.AspNet.Server.Kestrel { public KestrelServerInformation(IConfiguration configuration) { + if (configuration == null) + { + throw new ArgumentNullException(nameof(configuration)); + } + Addresses = GetAddresses(configuration); ThreadCount = GetThreadCount(configuration); NoDelay = GetNoDelay(configuration); diff --git a/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs b/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs index 1c56258554..2513d93e84 100644 --- a/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs +++ b/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs @@ -11,6 +11,12 @@ namespace Microsoft.AspNet.Server.KestrelTests { public class KestrelServerInformationTests { + [Fact] + public void NullConfigurationThrows() + { + Assert.Throws(() => new KestrelServerInformation(null)); + } + [Fact] public void SetThreadCountUsingConfiguration() {