Bug 16427 - Resource ids are no always updated
Summary: Resource ids are no always updated
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.2.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2013-11-24 13:49 UTC by ilya.golovach
Modified: 2017-07-06 16:03 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description ilya.golovach 2013-11-24 13:49:32 UTC
Description of Problem:
Resource ids are not always updated when renaming the file

Steps to reproduce the problem:
1. Create new Android app (Honeycomb) 
2. Open Main.axml in designer view
3. Select Button, open Resource view for Background and choose Icon
4. Save Main.axml
5. Rename Icon.png in Solution explorer to my_icon.png.
5. The new name is not update in Resource.designer.cs
6. Restart the Studio - the name is not update still
7. Remove @drawable/Icon as background from the button.
8. The new name is updated in Resource.designer.cs and appears to be my_icon now
9. Rename my_icon.png in Solution explorer to my__new_icon.png.
10. Check Resource.designer.cs - new name appears there right away
11. Open Resources view to set background for the button.
12. The id is not updated there - still is my_icon
13. Cleaning the project or refreshing folders in Solution explorer does not help
14. Restarting the solution fixes the issue.

Actual Results:

Expected Results:
The id should be updated right away. Bonus result: the ids should be updated in all places, even when they are assigned to some control (for example, in describe case - as background of the button)

How often does this happen? 
100% cases

Additional Information:
Comment 1 Mikayla Hutchinson [MSFT] 2014-02-11 19:26:43 UTC
I'm pretty sure this is due to recent changes in aapt causing it to validate that there are no references to missing resources. This means that the Resource.designer.cs will not updated until all files that refer to the renamed/removed resource have also been updated. 

See e.g. http://forums.xamarin.com/discussion/comment/43614/#Comment_43614
Comment 2 Mikayla Hutchinson [MSFT] 2014-02-11 19:27:57 UTC
One possible solution would be https://bugzilla.xamarin.com/show_bug.cgi?id=5870#c14
Comment 3 Cody Beyer (MSFT) 2017-07-06 16:03:24 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.