Skip to content

[fix-finder] Use Properties.Resources.XA0002 instead of hardcoded string in GetMonoPlatformJar #11650

@github-actions

Description

@github-actions

Problem

GetMonoPlatformJar.RunTask passes a hardcoded English string to Log.LogCodedError ("XA0002", ...), even though an XA0002 resource already exists in Properties/Resources.resx with the identical text and is already translated into 16 languages. Because the call uses the literal instead of the resource, this error message is never localized.

Location

  • File(s): src/Xamarin.Android.Build.Tasks/Tasks/GetMonoPlatformJar.cs
  • Line(s): 38

Current Code

Log.LogCodedError ("XA0002", "Could not find mono.android.jar");

Suggested Fix

Replace the hardcoded literal with the existing strongly-typed resource:

Log.LogCodedError ("XA0002", Properties.Resources.XA0002);

The XA0002 resource already exists in src/Xamarin.Android.Build.Tasks/Properties/Resources.resx with the value Could not find mono.android.jar (verified byte-for-byte identical), and the generated property Xamarin.Android.Tasks.Properties.Resources.XA0002 is already present in Resources.Designer.cs. Therefore no .resx, Resources.Designer.cs, or documentation changes are required — this is a single-line edit. The English output is unchanged; the fix simply enables the translations that already ship for the other cultures.

Guidelines

  • Only modify the one line in GetMonoPlatformJar.cs. Do NOT edit Resources.resx, Resources.Designer.cs, the non-English Resources.*.resx files, or Documentation/docs-mobile/messages/xa0002.md — they already contain the correct content.
  • This matches the established pattern already used in the same project, e.g. Tasks/Lint.cs:
    Log.LogCodedError ("XA5205", Properties.Resources.XA5205_Lint, ToolName);
  • GetMonoPlatformJar is in namespace Xamarin.Android.Tasks; the resource class is Xamarin.Android.Tasks.Properties.Resources, so Properties.Resources.XA0002 resolves without adding any using directive. The file is already #nullable enable, and the proven Lint.cs call sites show this compiles without a nullable warning.

Acceptance Criteria

  • GetMonoPlatformJar.cs line 38 uses Properties.Resources.XA0002 instead of the hardcoded string "Could not find mono.android.jar"
  • No changes to any .resx, Resources.Designer.cs, or documentation files
  • All tests pass
  • No new warnings introduced

Fix-finder metadata

  • Script: 08-string-literal-error-messages
  • Score: 29/30 (actionability: 10, safety: 9, scope: 10)

Generated by Nightly Fix Finder · 687 AIC · ⌖ 49.5 AIC · ⊞ 40.4K ·

  • expires on Jun 20, 2026, 2:35 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions