From e8d32c109d4e7b0804615302808221ebf1588a06 Mon Sep 17 00:00:00 2001 From: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> Date: Mon, 19 Sep 2022 10:43:49 -0700 Subject: [PATCH] Small diagnostics improvements to HostWriter (#75593) - Print out file permissions in octal (as per Linux standard) - Actually print out error enum value when MachO processing fails --- .../Microsoft.NET.HostModel/AppHost/AppHostExceptions.cs | 1 + .../managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/AppHost/AppHostExceptions.cs b/src/installer/managed/Microsoft.NET.HostModel/AppHost/AppHostExceptions.cs index ceae7c46cdc..fe934661af6 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/AppHost/AppHostExceptions.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/AppHost/AppHostExceptions.cs @@ -37,6 +37,7 @@ public sealed class AppHostMachOFormatException : AppHostUpdateException public readonly MachOFormatError Error; internal AppHostMachOFormatException(MachOFormatError error) + : base($"Failed to process MachO file: {error}") { Error = error; } diff --git a/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs b/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs index be83a7067d7..bbb1b421aac 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs @@ -141,7 +141,7 @@ void UpdateResources() if (chmodReturnCode == -1) { - throw new Win32Exception(Marshal.GetLastWin32Error(), $"Could not set file permission {filePermissionOctal} for {appHostDestinationFilePath}."); + throw new Win32Exception(Marshal.GetLastWin32Error(), $"Could not set file permission {Convert.ToString(filePermissionOctal, 8)} for {appHostDestinationFilePath}."); } if (enableMacOSCodeSign && RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && HostModelUtils.IsCodesignAvailable()) -- GitLab