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
-
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."
-
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);
-
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.
-
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
Generated by Nightly Fix Finder · ● 25.6M · ◷
Problem
ELFHelper.cshas three hardcoded warning strings passed directly tolog.LogWarning()without XA warning codes or resource lookups. These should useLogCodedWarningwithProperties.Resourcesentries for consistency and localizability, matching the pattern already used in the same file (e.g.,XA0141on line 83).Location
src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cslog.LogWarning ($"Attempt to check whether '{path}' is a correctly aligned ELF file failed with exception, ignoring alignment check for the file.");log.LogWarning ($"Attempt to check whether '{path}' is a valid ELF file failed with exception, ignoring AOT check for the file.");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
Suggested Fix
Add three new resource strings to
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx(and updateResources.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."Replace the hardcoded strings with coded warnings:
Create documentation files for the new warning codes:
Documentation/docs-mobile/messages/xa0146.mdDocumentation/docs-mobile/messages/xa0147.mdDocumentation/docs-mobile/messages/xa0148.mdFollow 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.Add the new codes to the table of contents in
Documentation/docs-mobile/messages/index.md.Guidelines
LogCodedWarningpattern already used inELFHelper.csline 83 (XA0141)Properties.Resources.XA####for the message format stringResources.resxfile (not localized versions)Resources.Designer.csfile should be regenerated (or manually updated to match)Acceptance Criteria
ELFHelper.csare replaced withlog.LogCodedWarningusingProperties.ResourcesResources.resxandResources.Designer.csDocumentation/docs-mobile/messages/index.md