Simply aggregate exception happens in failed apphost deletion
authorWilliam Li <wul@microsoft.com>
Wed, 24 Jul 2019 23:58:48 +0000 (16:58 -0700)
committerWilliam Li <wul@microsoft.com>
Thu, 25 Jul 2019 00:06:27 +0000 (17:06 -0700)
Commit migrated from https://github.com/dotnet/core-setup/commit/bad4dd11c3fcb1fd685008da33841b82aa195ef2

src/installer/managed/Microsoft.NET.HostModel/AppHost/FailedToDeleteApphostException.cs [deleted file]
src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs

diff --git a/src/installer/managed/Microsoft.NET.HostModel/AppHost/FailedToDeleteApphostException.cs b/src/installer/managed/Microsoft.NET.HostModel/AppHost/FailedToDeleteApphostException.cs
deleted file mode 100644 (file)
index c033a39..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace Microsoft.NET.HostModel.AppHost
-{
-    /// <summary>
-    /// Failed to delete apphost when trying to delete incomplete appphost
-    /// </summary>
-    public class FailedToDeleteApphostException : AppHostUpdateException
-    {
-        public string ExceptionMessage { get; }
-        public FailedToDeleteApphostException(string exceptionMessage)
-        {
-            ExceptionMessage = exceptionMessage;
-        }
-    }
-}
-
index e3a9177..9e7ab6a 100644 (file)
@@ -88,20 +88,14 @@ namespace Microsoft.NET.HostModel.AppHost
             }
             catch (Exception ex)
             {
-                FailedToDeleteApphostException failedToDeleteApphostException = null;
                 // Delete the destination file so we don't leave an unmodified apphost
                 try
                 {
                     File.Delete(appHostDestinationFilePath);
                 }
-                catch (Exception failedToDeleteEx) when (failedToDeleteEx is IOException || failedToDeleteEx is UnauthorizedAccessException)
+                catch (Exception failedToDeleteEx)
                 {
-                    failedToDeleteApphostException = new FailedToDeleteApphostException(failedToDeleteEx.Message);
-                }
-
-                if (failedToDeleteApphostException != null)
-                {
-                    throw new AggregateException(ex, failedToDeleteApphostException);
+                    throw new AggregateException(ex, failedToDeleteEx);
                 }
 
                 throw;