Skip to content

Move hardcoded IL6001 warning string to Resources.resx#11594

Merged
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-finder-move-warning-to-resources-resx
Jun 8, 2026
Merged

Move hardcoded IL6001 warning string to Resources.resx#11594
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-finder-move-warning-to-resources-resx

Conversation

Copilot AI commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

CheckForObsoletePreserveAttributeStep.cs passes a hardcoded string literal to LogCodedWarning instead of using a resource string, making it non-localizable and inconsistent with the rest of the codebase.

  • Added IL6001 entry to Properties/Resources.resx with {0} format placeholder for the assembly name
  • Added corresponding IL6001 property to Resources.Designer.cs
  • Added using Resources = Xamarin.Android.Tasks.Properties.Resources; alias (matching existing convention in Linker/MonoDroid.Tuner/)
  • Replaced inline string with Resources.IL6001 reference:
// Before
log.LogCodedWarning ("IL6001", $"Assembly '{assembly.Name.Name}' contains reference to obsolete attribute...");

// After
log.LogCodedWarning ("IL6001", Resources.IL6001, assembly.Name.Name);

Warning message text is unchanged; existing LinkerTests.cs assertions remain valid.

Add IL6001 resource entry to Properties/Resources.resx and
Resources.Designer.cs. Update CheckForObsoletePreserveAttributeStep
to use Resources.IL6001 with a using alias, matching the established
convention in the Linker/MonoDroid.Tuner/ directory.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hardcoded IL6001 warning in CheckForObsoletePreserveAttributeStep Move hardcoded IL6001 warning string to Resources.resx Jun 6, 2026
Copilot AI requested a review from jonathanpeppers June 6, 2026 02:54
@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 8, 2026 17:28
Copilot AI review requested due to automatic review settings June 8, 2026 17:28
@jonathanpeppers jonathanpeppers merged commit 82ef796 into main Jun 8, 2026
3 of 4 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-finder-move-warning-to-resources-resx branch June 8, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves localization consistency in Xamarin.Android.Build.Tasks by moving the IL6001 warning text from an inline string literal into Properties/Resources.resx, so it can be localized and managed like other coded messages.

Changes:

  • Added a new IL6001 entry to src/Xamarin.Android.Build.Tasks/Properties/Resources.resx.
  • Added the corresponding strongly-typed Resources.IL6001 accessor in Resources.Designer.cs.
  • Updated CheckForObsoletePreserveAttributeStep to log IL6001 using the resource string + format argument.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx Adds the IL6001 localized message string.
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs Exposes IL6001 via the generated strongly-typed resources API.
src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/CheckForObsoletePreserveAttributeStep.cs Switches the warning to use Resources.IL6001 with the assembly name parameter.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Language not supported

Comment on lines +145 to +147
<data name="IL6001" xml:space="preserve">
<value>Assembly '{0}' contains reference to obsolete attribute 'Android.Runtime.PreserveAttribute'. Members with this attribute may be trimmed. Please use System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute instead</value>
</data>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Move hardcoded IL6001 warning in CheckForObsoletePreserveAttributeStep to Resources.resx

3 participants