Problem
PrepareAbiItems.cs line 64 uses Log.LogError with a hardcoded string literal instead of using a coded error from Properties.Resources. This means the error message is not localizable and lacks a proper XA#### error code for documentation and troubleshooting.
Location
- File(s):
src/Xamarin.Android.Build.Tasks/Tasks/PrepareAbiItems.cs
- Line(s): 64
Current Code
Log.LogError ($"Unknown mode: {Mode}");
Suggested Fix
- Add a new resource string to the English
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx:
<data name="XA0000_PrepareAbiItems_UnknownMode" xml:space="preserve">
<value>Unknown mode: {0}</value>
</data>
-
Regenerate Resources.Designer.cs (or add the corresponding property manually).
-
Replace the hardcoded Log.LogError call in PrepareAbiItems.cs line 64 with:
Log.LogCodedError ("XA0000", Properties.Resources.XA0000_PrepareAbiItems_UnknownMode, Mode);
This reuses the existing generic XA0000 error code, so no new documentation file is needed.
Important: The owning project (Xamarin.Android.Build.Tasks.csproj) targets netstandard2.0. The suggested fix only uses Log.LogCodedError and Properties.Resources, both of which are available on netstandard2.0. Do not use any APIs that require net6.0+ (e.g. ArgumentNullException.ThrowIfNull).
Guidelines
- Only modify the English
Resources.resx — never modify non-English *.resx or *.lcl files
- Follow Mono formatting style (tabs, space before
()
- Use
string.Format-style {0} placeholders in resource strings
Acceptance Criteria
Fix-finder metadata
- Script:
08-string-literal-error-messages
- Score:
25/30 (actionability: 9, safety: 8, scope: 8)
Generated by Nightly Fix Finder · ● 10.4M · ◷
Problem
PrepareAbiItems.csline 64 usesLog.LogErrorwith a hardcoded string literal instead of using a coded error fromProperties.Resources. This means the error message is not localizable and lacks a properXA####error code for documentation and troubleshooting.Location
src/Xamarin.Android.Build.Tasks/Tasks/PrepareAbiItems.csCurrent Code
Suggested Fix
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx:Regenerate
Resources.Designer.cs(or add the corresponding property manually).Replace the hardcoded
Log.LogErrorcall inPrepareAbiItems.csline 64 with:This reuses the existing generic
XA0000error code, so no new documentation file is needed.Important: The owning project (
Xamarin.Android.Build.Tasks.csproj) targetsnetstandard2.0. The suggested fix only usesLog.LogCodedErrorandProperties.Resources, both of which are available onnetstandard2.0. Do not use any APIs that requirenet6.0+(e.g.ArgumentNullException.ThrowIfNull).Guidelines
Resources.resx— never modify non-English*.resxor*.lclfiles()string.Format-style{0}placeholders in resource stringsAcceptance Criteria
Log.LogErroron line 64 ofPrepareAbiItems.csis replaced withLog.LogCodedErrorusing a resource stringsrc/Xamarin.Android.Build.Tasks/Properties/Resources.resxResources.Designer.csis updated with the new propertyFix-finder metadata
08-string-literal-error-messages25/30(actionability:9, safety:8, scope:8)