Problem
Two MSBuild tasks use Log.LogError with hardcoded, non-localized strings and no XA error codes. These should use Properties.Resources entries with proper XA#### codes for consistency and localizability.
Location
- File 1:
src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.cs
- Line 34:
Log.LogError ($"Unable to load assembly '{mono_android}'")
- File 2:
src/Xamarin.Android.Build.Tasks/Tasks/GenerateCompressedAssembliesNativeSourceFiles.cs
- Line 76:
Log.LogError ($"Assembly {assembly.ItemSpec} does not exist")
Current Code
RemoveRegisterAttribute.cs:34
Log.LogError ($"Unable to load assembly '{mono_android}'");
GenerateCompressedAssembliesNativeSourceFiles.cs:76
Log.LogError ($"Assembly {assembly.ItemSpec} does not exist");
Suggested Fix
-
Add two new resource strings to src/Xamarin.Android.Build.Tasks/Properties/Resources.resx (and Resources.Designer.cs). Use available error codes XA2024 and XA2025:
XA2024: "Unable to load assembly '{0}'."
XA2025: "Assembly {0} does not exist."
-
Replace the hardcoded strings with coded errors:
// RemoveRegisterAttribute.cs
Log.LogCodedError ("XA2024", Properties.Resources.XA2024, mono_android);
// GenerateCompressedAssembliesNativeSourceFiles.cs
Log.LogCodedError ("XA2025", Properties.Resources.XA2025, assembly.ItemSpec);
-
Create documentation files for the new error codes:
Documentation/docs-mobile/messages/xa2024.md
Documentation/docs-mobile/messages/xa2025.md
Follow the existing format (frontmatter with title/description/date/f1_keywords, then sections for Example messages, Issue explanation, and Solution).
-
Add the new codes to the table of contents in Documentation/docs-mobile/messages/index.md.
Guidelines
- Follow the existing pattern for
LogCodedError calls in the codebase
- Use
Properties.Resources.XA#### for the message format string
- Only modify the main English
Resources.resx file (not localized versions)
- The
Resources.Designer.cs file should be regenerated (or manually updated to match)
- Check that error codes XA2024 and XA2025 are not already in use before committing — if they are, pick the next available codes
Acceptance Criteria
Generated by Nightly Fix Finder · ● 17M · ◷
Problem
Two MSBuild tasks use
Log.LogErrorwith hardcoded, non-localized strings and no XA error codes. These should useProperties.Resourcesentries with properXA####codes for consistency and localizability.Location
src/Xamarin.Android.Build.Tasks/Tasks/RemoveRegisterAttribute.csLog.LogError ($"Unable to load assembly '{mono_android}'")src/Xamarin.Android.Build.Tasks/Tasks/GenerateCompressedAssembliesNativeSourceFiles.csLog.LogError ($"Assembly {assembly.ItemSpec} does not exist")Current Code
RemoveRegisterAttribute.cs:34
GenerateCompressedAssembliesNativeSourceFiles.cs:76
Suggested Fix
Add two new resource strings to
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx(andResources.Designer.cs). Use available error codes XA2024 and XA2025:XA2024:"Unable to load assembly '{0}'."XA2025:"Assembly {0} does not exist."Replace the hardcoded strings with coded errors:
Create documentation files for the new error codes:
Documentation/docs-mobile/messages/xa2024.mdDocumentation/docs-mobile/messages/xa2025.mdFollow the existing format (frontmatter with title/description/date/f1_keywords, then sections for Example messages, Issue explanation, and Solution).
Add the new codes to the table of contents in
Documentation/docs-mobile/messages/index.md.Guidelines
LogCodedErrorcalls in the codebaseProperties.Resources.XA####for the message format stringResources.resxfile (not localized versions)Resources.Designer.csfile should be regenerated (or manually updated to match)Acceptance Criteria
Log.LogCodedErrorusingProperties.ResourcesResources.resxandResources.Designer.csDocumentation/docs-mobile/messages/index.md