Skip to content

[fix-finder] Move hardcoded warning strings in ELFHelper.cs to Properties.Resources with XA warning codes #11474

@github-actions

Description

@github-actions

Problem

ELFHelper.cs has three hardcoded warning strings passed directly to log.LogWarning() without XA warning codes or resource lookups. These should use LogCodedWarning with Properties.Resources entries for consistency and localizability, matching the pattern already used in the same file (e.g., XA0141 on line 83).

Location

  • File: src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs
  • Line 45: log.LogWarning ($"Attempt to check whether '{path}' is a correctly aligned ELF file failed with exception, ignoring alignment check for the file.");
  • Line 131: log.LogWarning ($"Attempt to check whether '{path}' is a valid ELF file failed with exception, ignoring AOT check for the file.");
  • Line 170: log.LogWarning ($"Attempt to check whether '{elfPath}' is a valid ELF file failed with exception, ignoring symbol '{symbolName}@{sectionName}' check for the file.");

Current Code

// Line 45
log.LogWarning ($"Attempt to check whether '{path}' is a correctly aligned ELF file failed with exception, ignoring alignment check for the file.");

// Line 131
log.LogWarning ($"Attempt to check whether '{path}' is a valid ELF file failed with exception, ignoring AOT check for the file.");

// Line 170
log.LogWarning ($"Attempt to check whether '{elfPath}' is a valid ELF file failed with exception, ignoring symbol '{symbolName}@{sectionName}' check for the file.");

Suggested Fix

  1. Add three new resource strings to src/Xamarin.Android.Build.Tasks/Properties/Resources.resx (and update Resources.Designer.cs). Use the next available warning codes XA0146, XA0147, and XA0148. Verify these codes are not already in use before committing — if they are, pick the next available codes.

    • XA0146: "Attempt to check whether '{0}' is a correctly aligned ELF file failed with exception, ignoring alignment check for the file."
    • XA0147: "Attempt to check whether '{0}' is a valid ELF file failed with exception, ignoring AOT check for the file."
    • XA0148: "Attempt to check whether '{0}' is a valid ELF file failed with exception, ignoring symbol '{1}@{2}' check for the file."
  2. Replace the hardcoded strings with coded warnings:

    // Line 45
    log.LogCodedWarning ("XA0146", Properties.Resources.XA0146, path);
    
    // Line 131
    log.LogCodedWarning ("XA0147", Properties.Resources.XA0147, path);
    
    // Line 170
    log.LogCodedWarning ("XA0148", Properties.Resources.XA0148, elfPath, symbolName, sectionName);
  3. Create documentation files for the new warning codes:

    • Documentation/docs-mobile/messages/xa0146.md
    • Documentation/docs-mobile/messages/xa0147.md
    • Documentation/docs-mobile/messages/xa0148.md

    Follow the existing format used by nearby codes (e.g., xa0141.md): frontmatter with title/description/date/f1_keywords, then sections for Example messages, Issue explanation, and Solution.

  4. Add the new codes to the table of contents in Documentation/docs-mobile/messages/index.md.

Guidelines

  • Follow the existing LogCodedWarning pattern already used in ELFHelper.cs line 83 (XA0141)
  • 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)

Acceptance Criteria

  • All three hardcoded warning strings in ELFHelper.cs are replaced with log.LogCodedWarning using Properties.Resources
  • New entries added to Resources.resx and Resources.Designer.cs
  • Documentation markdown files created for each new warning code
  • New codes added to Documentation/docs-mobile/messages/index.md
  • All tests pass
  • No new warnings introduced

Generated by Nightly Fix Finder · ● 25.6M ·

  • expires on Jun 1, 2026, 2:31 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