From fd60b91e5763995f4f7948c5fc6d4d38e6771f72 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 25 Feb 2022 11:20:31 +0100 Subject: [PATCH] [dotnet-linker] Improve the error message from the linker when we run into a problem. * Better text. * Better number ("7000" is more like "this is kind of normal" - while "6999" was more like "something quite expected happened"). * Use resources to make it localizable. --- tools/dotnet-linker/LinkerConfiguration.cs | 3 +-- tools/mtouch/Errors.designer.cs | 9 +++++++++ tools/mtouch/Errors.resx | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/dotnet-linker/LinkerConfiguration.cs b/tools/dotnet-linker/LinkerConfiguration.cs index 119154ed997a..3867cddf2dce 100644 --- a/tools/dotnet-linker/LinkerConfiguration.cs +++ b/tools/dotnet-linker/LinkerConfiguration.cs @@ -457,10 +457,9 @@ public static void Report (LinkContext context, IList exceptions) var list = ErrorHelper.CollectExceptions (exceptions); var allWarnings = list.All (v => v is ProductException pe && !pe.Error); if (!allWarnings) { - // Revisit the error code after https://github.com/mono/linker/issues/1596 has been fixed. var instance = GetInstance (context, false); var platform = (instance?.Platform)?.ToString () ?? "unknown"; - var msg = MessageContainer.CreateCustomErrorMessage ("Failed to execute the custom steps.", 6999, platform); + var msg = MessageContainer.CreateCustomErrorMessage (Errors.MX7000 /* An error occured while executing the custom linker steps. Please review the build log for more information. */, 7000, platform); context.LogMessage (msg); } // ErrorHelper.Show will print our errors and warnings to stderr. diff --git a/tools/mtouch/Errors.designer.cs b/tools/mtouch/Errors.designer.cs index 36dc2bde7334..5d24fc1be31f 100644 --- a/tools/mtouch/Errors.designer.cs +++ b/tools/mtouch/Errors.designer.cs @@ -4042,6 +4042,15 @@ public static string MX5315 { } } + /// + /// Looks up a localized string similar to An error occured while executing the custom linker steps. Please review the build log for more information.. + /// + public static string MX7000 { + get { + return ResourceManager.GetString("MX7000", resourceCulture); + } + } + /// /// Looks up a localized string similar to Don't know how to marshal the parameter of type {0} for parameter {1} in call to {2}. /// diff --git a/tools/mtouch/Errors.resx b/tools/mtouch/Errors.resx index 0e36f2f3f82f..96aa47117011 100644 --- a/tools/mtouch/Errors.resx +++ b/tools/mtouch/Errors.resx @@ -2114,6 +2114,13 @@ + + + An error occured while executing the custom linker steps. Please review the build log for more information. + + + + Internal consistency error. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.