Move hardcoded error string in PrepareAbiItems.cs to Resources.resx - #11574
Conversation
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Add XA0000_PrepareAbiItems_UnknownMode resource string and replace Log.LogError with Log.LogCodedError using the XA0000 error code. Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
|
@copilot the error code also verify there isn't an existing message we could use for this that is already localized and has a code. |
Pick an unused error code (XA0037) for the PrepareAbiItems unknown-mode error rather than reusing the generic XA0000. Add documentation for the new code. Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Switched to the dedicated unused code XA0037 (next free code after XA0036 in the |
There was a problem hiding this comment.
Pull request overview
This PR localizes a previously hardcoded error message in the PrepareAbiItems MSBuild task by introducing a new XA#### coded error (XA0037) backed by Resources.resx, and adds corresponding documentation for the new error code.
Changes:
- Added localized resource string
XA0037(“Unknown mode: {0}”) and the corresponding generated designer accessor. - Updated
PrepareAbiItemsto logXA0037viaLog.LogCodedErrorinstead of a hardcoded string. - Added a new docs page for
XA0037and linked it from the messages index.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tasks/PrepareAbiItems.cs | Switches from hardcoded Log.LogError to Log.LogCodedError using XA0037. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.resx | Adds the localized XA0037 message text and placeholder comment. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs | Adds the generated XA0037 property accessor. |
| Documentation/docs-mobile/messages/xa0037.md | Documents the new XA0037 error code and user guidance. |
| Documentation/docs-mobile/messages/index.md | Adds XA0037 to the error/warning reference index. |
| build-tools/banned-apis/banned-apis.targets | Reformatting/line-ending-only change (unrelated to XA0037 localization). |
Files not reviewed (1)
- src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Language not supported
| <Project> | ||
| <PropertyGroup> | ||
| <WarningsAsErrors>RS0030</WarningsAsErrors> | ||
| </PropertyGroup> |
There was a problem hiding this comment.
this is breaking CI in other places, so I'm inclined to merge this, it's causing weird things!
PrepareAbiItems.csusesLog.LogErrorwith a hardcoded string literal, bypassing the localization pipeline and lacking a properXA####error code.Changes
Properties/Resources.resx: AddXA0037resource string (Unknown mode: {0})Properties/Resources.Designer.cs: Add corresponding generated propertyTasks/PrepareAbiItems.cs: ReplaceLog.LogErrorwithLog.LogCodedErrorDocumentation/docs-mobile/messages/xa0037.mdandindex.md: Add documentation for the newXA0037error codeUses a dedicated, previously-unused error code
XA0037(the next free code afterXA0036in theXA0xxxrange) rather than the genericXA0000. No existing localized coded message matched this internal "unknown mode" error, so a new code and resource string were added.