Simplifying ApplicationLifetime.ExecuteHandlers() (#1228)

This commit is contained in:
KPixel 2017-09-22 15:16:48 +02:00 committed by David Fowler
parent f4cb62982a
commit 27a3a89b60
2 changed files with 4 additions and 45 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}