Bug 56082 - Resource designer stops getting updated
Summary: Resource designer stops getting updated
Status: RESOLVED NORESPONSE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Designer ()
Version: 6.3 (15.1)
Hardware: PC Mac OS
: --- normal
Target Milestone: master
Assignee: Jérémie Laval
URL:
Depends on:
Blocks:
 
Reported: 2017-05-07 12:29 UTC by arvind.joshi
Modified: 2017-07-17 21:56 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED NORESPONSE

Description arvind.joshi 2017-05-07 12:29:54 UTC
I am facing a problem with Xamarin Studio version 6.3 (build 683). Suddenly the Resource.designer.cs stops updating. I have identified a couple of times that it happens. However there are other situations when this happens and I have not been able to find the cause. 
1. If I copy-paste UI code (.axml) from outside e.g. some code sample from the web, some times some weird characters end up in the editor. When the .axml is saved the generation of Resource.designer.cs fails and then onwards none of the changes I make are reflected.
2. If I select "Remove" option for an element (say from the drawable folder) and then on the dialog that is shown, I select "Delete" instead of "Remove from project". When the item is deleted, it's reference is not removed from Resource.designer.cs file. From that point on the Resource.designer.cs file does not get updated.

When the updating stops, none of the other options that I have found on various forums help. The .csproj file is fine, and deleting the Resource.designer.cs generates only a new empty file etc.

We recently started developing using Xamarin.Android and in the last 4 days I have lost 16 hours due to rework (recreating the solution and adding files again) due to this issue. I am now having to take a code back up 5-6 times in a day just to be able to go back to the most recent working version.

There has to be an easier way to rebuild the Resource.designer.cs when it stops updating automatically. Urgently need a solution to do that.
Comment 1 Jon Douglas [MSFT] 2017-06-19 19:00:04 UTC
(In reply to arvind.joshi from comment #0)
> I am facing a problem with Xamarin Studio version 6.3 (build 683). Suddenly
> the Resource.designer.cs stops updating. I have identified a couple of times
> that it happens. However there are other situations when this happens and I
> have not been able to find the cause. 
> 1. If I copy-paste UI code (.axml) from outside e.g. some code sample from
> the web, some times some weird characters end up in the editor. When the
> .axml is saved the generation of Resource.designer.cs fails and then onwards
> none of the changes I make are reflected.
> 2. If I select "Remove" option for an element (say from the drawable folder)
> and then on the dialog that is shown, I select "Delete" instead of "Remove
> from project". When the item is deleted, it's reference is not removed from
> Resource.designer.cs file. From that point on the Resource.designer.cs file
> does not get updated.
> 
> When the updating stops, none of the other options that I have found on
> various forums help. The .csproj file is fine, and deleting the
> Resource.designer.cs generates only a new empty file etc.
> 
> We recently started developing using Xamarin.Android and in the last 4 days
> I have lost 16 hours due to rework (recreating the solution and adding files
> again) due to this issue. I am now having to take a code back up 5-6 times
> in a day just to be able to go back to the most recent working version.
> 
> There has to be an easier way to rebuild the Resource.designer.cs when it
> stops updating automatically. Urgently need a solution to do that.

What I believe is happening is that the "aapt" process is failing silently in your case. Your usecase of the resource.designer.cs file only generating an empty file or not updating sounds like aapt failure. The tricky part is figuring out where the failure is within the aapt call.

Here's a stack overflow answer regarding how this works: https://stackoverflow.com/questions/40451758/can-someone-actually-explain-the-workings-of-resource-designer-cs/40456727#40456727

To help diagnose this issue, please attach a diagnostic build log:

https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

One thing to be weary of is that the aapt tooling requires that your resources are named correctly. i.e. "File-based resource names must contain only lowercase a-z, 0-9, or underscore characters."
Comment 2 Jon Douglas [MSFT] 2017-07-17 21:56:12 UTC
Marking this as NO RESPONSE as per my followup comment in https://bugzilla.xamarin.com/show_bug.cgi?id=56082#c1