#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)
|
if (exceptions.Count > 0)
|
||||||
{
|
{
|
||||||
hostingStartupErrors = new AggregateException(exceptions);
|
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]
|
[Fact]
|
||||||
public void Build_ThrowsIfUnloadableAssemblyNameInHostingStartupAssemblies()
|
public void Build_DoesntThrowIfUnloadableAssemblyNameInHostingStartupAssemblies()
|
||||||
{
|
{
|
||||||
var builder = CreateWebHostBuilder()
|
var builder = CreateWebHostBuilder()
|
||||||
.CaptureStartupErrors(false)
|
.CaptureStartupErrors(false)
|
||||||
|
|
@ -983,9 +983,10 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
.Configure(app => { })
|
.Configure(app => { })
|
||||||
.UseServer(new TestServer());
|
.UseServer(new TestServer());
|
||||||
|
|
||||||
var ex = Assert.Throws<AggregateException>(() => builder.Build());
|
using (builder.Build())
|
||||||
Assert.IsType<InvalidOperationException>(ex.InnerExceptions[0]);
|
{
|
||||||
Assert.IsType<FileNotFoundException>(ex.InnerExceptions[0].InnerException);
|
Assert.Equal("0", builder.GetSetting("testhostingstartup"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue