Simplifying ApplicationLifetime.ExecuteHandlers() (#1228)
This commit is contained in:
parent
f4cb62982a
commit
27a3a89b60
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
|
@ -108,28 +107,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
|
|||
return;
|
||||
}
|
||||
|
||||
List<Exception> exceptions = null;
|
||||
|
||||
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);
|
||||
}
|
||||
// Run the cancellation token callbacks
|
||||
cancel.Cancel(throwOnFirstException: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,28 +107,8 @@ namespace Microsoft.Extensions.Hosting.Internal
|
|||
return;
|
||||
}
|
||||
|
||||
List<Exception> exceptions = null;
|
||||
|
||||
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);
|
||||
}
|
||||
// Run the cancellation token callbacks
|
||||
cancel.Cancel(throwOnFirstException: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue