#1075 Suppress exceptions from failing to load HostingStartup assemblies
This commit is contained in:
parent
68d1d4ce12
commit
7ac6842d18
|
|
@ -285,12 +285,6 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
if (exceptions.Count > 0)
|
||||
{
|
||||
hostingStartupErrors = new AggregateException(exceptions);
|
||||
|
||||
// Throw directly if we're not capturing startup errors
|
||||
if (!_options.CaptureStartupErrors)
|
||||
{
|
||||
throw hostingStartupErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_ThrowsIfUnloadableAssemblyNameInHostingStartupAssemblies()
|
||||
public void Build_DoesntThrowIfUnloadableAssemblyNameInHostingStartupAssemblies()
|
||||
{
|
||||
var builder = CreateWebHostBuilder()
|
||||
.CaptureStartupErrors(false)
|
||||
|
|
@ -983,9 +983,10 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
.Configure(app => { })
|
||||
.UseServer(new TestServer());
|
||||
|
||||
var ex = Assert.Throws<AggregateException>(() => builder.Build());
|
||||
Assert.IsType<InvalidOperationException>(ex.InnerExceptions[0]);
|
||||
Assert.IsType<FileNotFoundException>(ex.InnerExceptions[0].InnerException);
|
||||
using (builder.Build())
|
||||
{
|
||||
Assert.Equal("0", builder.GetSetting("testhostingstartup"));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue