From 27a3a89b6052747526ed17901b8ea9dcef3ae682 Mon Sep 17 00:00:00 2001 From: KPixel Date: Fri, 22 Sep 2017 15:16:48 +0200 Subject: [PATCH] Simplifying ApplicationLifetime.ExecuteHandlers() (#1228) --- .../Internal/ApplicationLifetime.cs | 25 ++----------------- .../Internal/ApplicationLifetime.cs | 24 ++---------------- 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/src/Microsoft.AspNetCore.Hosting/Internal/ApplicationLifetime.cs b/src/Microsoft.AspNetCore.Hosting/Internal/ApplicationLifetime.cs index b370d37dd2..47d16e9654 100644 --- a/src/Microsoft.AspNetCore.Hosting/Internal/ApplicationLifetime.cs +++ b/src/Microsoft.AspNetCore.Hosting/Internal/ApplicationLifetime.cs @@ -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 exceptions = null; - - try - { - // Run the cancellation token callbacks - cancel.Cancel(throwOnFirstException: false); - } - catch (Exception ex) - { - if (exceptions == null) - { - exceptions = new List(); - } - - 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); } } } diff --git a/src/Microsoft.Extensions.Hosting/Internal/ApplicationLifetime.cs b/src/Microsoft.Extensions.Hosting/Internal/ApplicationLifetime.cs index d94064a1e7..c9bb70415d 100644 --- a/src/Microsoft.Extensions.Hosting/Internal/ApplicationLifetime.cs +++ b/src/Microsoft.Extensions.Hosting/Internal/ApplicationLifetime.cs @@ -107,28 +107,8 @@ namespace Microsoft.Extensions.Hosting.Internal return; } - List exceptions = null; - - try - { - // Run the cancellation token callbacks - cancel.Cancel(throwOnFirstException: false); - } - catch (Exception ex) - { - if (exceptions == null) - { - exceptions = new List(); - } - - 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); } } }