Simplifying ApplicationLifetime.ExecuteHandlers() (#1228)
This commit is contained in:
parent
f4cb62982a
commit
27a3a89b60
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
@ -108,28 +107,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Exception> exceptions = null;
|
// Run the cancellation token callbacks
|
||||||
|
cancel.Cancel(throwOnFirstException: false);
|
||||||
try
|
|
||||||
{
|
|
||||||
// Run the cancellation token callbacks
|
|
||||||
cancel.Cancel(throwOnFirstException: false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (exceptions == null)
|
|
||||||
{
|
|
||||||
exceptions = new List<Exception>();
|
|
||||||
}
|
|
||||||
|
|
||||||
exceptions.Add(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Throw an aggregate exception if there were any exceptions
|
|
||||||
if (exceptions != null)
|
|
||||||
{
|
|
||||||
throw new AggregateException(exceptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,28 +107,8 @@ namespace Microsoft.Extensions.Hosting.Internal
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Exception> exceptions = null;
|
// Run the cancellation token callbacks
|
||||||
|
cancel.Cancel(throwOnFirstException: false);
|
||||||
try
|
|
||||||
{
|
|
||||||
// Run the cancellation token callbacks
|
|
||||||
cancel.Cancel(throwOnFirstException: false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (exceptions == null)
|
|
||||||
{
|
|
||||||
exceptions = new List<Exception>();
|
|
||||||
}
|
|
||||||
|
|
||||||
exceptions.Add(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Throw an aggregate exception if there were any exceptions
|
|
||||||
if (exceptions != null)
|
|
||||||
{
|
|
||||||
throw new AggregateException(exceptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue