Skip to content

Move hardcoded error strings in RemoveRegisterAttribute and GenerateCompressedAssembliesNativeSourceFiles to Properties.Resources#11470

Merged
simonrozsival merged 2 commits into
mainfrom
copilot/fix-log-error-strings
May 27, 2026
Merged

Move hardcoded error strings in RemoveRegisterAttribute and GenerateCompressedAssembliesNativeSourceFiles to Properties.Resources#11470
simonrozsival merged 2 commits into
mainfrom
copilot/fix-log-error-strings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

Two MSBuild tasks used Log.LogError with hardcoded, non-localized strings and no XA error codes. This replaces them with Log.LogCodedError using Properties.Resources entries.

Changes

  • New error codes XA2024 / XA2025 added to Resources.resx and Resources.Designer.cs
  • RemoveRegisterAttribute.cs and GenerateCompressedAssembliesNativeSourceFiles.cs — replaced Log.LogError with Log.LogCodedError
  • Documentation — added xa2024.md, xa2025.md, and updated index.md
// Before
Log.LogError ($"Unable to load assembly '{mono_android}'");
Log.LogError ($"Assembly {assembly.ItemSpec} does not exist");

// After
Log.LogCodedError ("XA2024", Properties.Resources.XA2024, mono_android);
Log.LogCodedError ("XA2025", Properties.Resources.XA2025, assembly.ItemSpec);

…XA2025 codes

Agent-Logs-Url: https://github.com/dotnet/android/sessions/e77e9808-9097-433d-bd71-ba569aa3f6eb

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hardcoded error strings in MSBuild tasks Move hardcoded error strings in RemoveRegisterAttribute and GenerateCompressedAssembliesNativeSourceFiles to Properties.Resources May 24, 2026
Copilot AI requested a review from jonathanpeppers May 24, 2026 02:54
@jonathanpeppers jonathanpeppers marked this pull request as ready for review May 26, 2026 17:56
Copilot AI review requested due to automatic review settings May 26, 2026 17:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR localizes previously hardcoded MSBuild task error strings by introducing new XA error codes and moving the message text into Properties.Resources, aligning these tasks with the rest of Xamarin.Android.Build.Tasks error-reporting patterns.

Changes:

  • Added new localized resource strings and error codes XA2024 / XA2025.
  • Updated RemoveRegisterAttribute and GenerateCompressedAssembliesNativeSourceFiles tasks to use Log.LogCodedError with Properties.Resources.
  • Added documentation pages for XA2024 / XA2025 and linked them from the messages index.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs Switches assembly-load failure logging to Log.LogCodedError with XA2024.
src/Xamarin.Android.Build.Tasks/Tasks/GenerateCompressedAssembliesNativeSourceFiles.cs Switches missing-assembly logging to Log.LogCodedError with XA2025.
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx Adds localized strings for XA2024 and XA2025.
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs Adds strongly-typed accessors for XA2024 / XA2025.
Documentation/docs-mobile/messages/xa2024.md Adds documentation for XA2024.
Documentation/docs-mobile/messages/xa2025.md Adds documentation for XA2025.
Documentation/docs-mobile/messages/index.md Adds links/entries for XA2024 and XA2025.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Language not supported

@simonrozsival simonrozsival merged commit e097075 into main May 27, 2026
7 checks passed
@simonrozsival simonrozsival deleted the copilot/fix-log-error-strings branch May 27, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants