Bug 21968 - Android Designer in Visual Studio occasionally overwrites your axml files.
Summary: Android Designer in Visual Studio occasionally overwrites your axml files.
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android Designer ()
Version: 3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jérémie Laval
: 24874 ()
Depends on:
Reported: 2014-08-08 16:04 UTC by Jeremy Kolb
Modified: 2015-10-29 06:03 UTC (History)
6 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 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 Jeremy Kolb 2014-08-08 16:04:28 UTC
Sometimes you can see your XML in the designer and it renders out a nice UI and you can save it to disk but it doesn't actually save... or it gets rewritten.  I'm not sure.  You will not be aware of this (except that your UI won't look right on the device) until you reboot and notice that the contents of your axml file are gone.

This is a really critical issue that has bit me three times in the last two weeks.
Comment 1 Arpit Jha 2014-08-26 09:27:06 UTC
I have checked this issue and unable to reproduce it.

I tried following steps to reproduce it.
1.Create Xamarin Android application.
2.Did change in button text.
3.Save the changes.
4.Go to Main.axml(designer) page.

I observed that changes done in string.xml were reflecting in Main.axml(designer) page.

Screencast: http://screencast.com/t/JkyglZFOMF

Environment info:

Could you please provide us Sample project.So that I can able to reproduce it.
Comment 2 Jeremy Kolb 2014-08-26 09:41:38 UTC
A sample project will be hard to supply as once you exit and reload the problem disappears.

I THINK it may have something to do with creating the file, opening it in the designer and then possibly renaming the file before or after editing.  I definitely saw the issue when I renamed a file before it was committed to source control.
Comment 4 Jeremy Kolb 2015-01-13 09:18:52 UTC
Thank you.  I hit this all the time when renaming axml files.
Comment 5 Jérémie Laval 2015-01-13 09:44:37 UTC
Sorry commented on the wrong bug report :-). We are working on it too though.
Comment 6 Jérémie Laval 2015-01-14 13:52:57 UTC
Fixed in master. Thanks for the report.

@Arpit to verify, create a new android application, open Main.axml, while the file tab is still there, rename Main.axml in the IDE to Main.axml2, do a change (e.g. change the button label), save the layout, make sure the change has been written to the right filename and that there is no dangling Main.axml file in the project folder.
Comment 7 Jérémie Laval 2015-01-14 13:54:45 UTC
*** Bug 24874 has been marked as a duplicate of this bug. ***
Comment 8 Arpit Jha 2015-01-15 02:23:44 UTC
I have checked this issue with the help of comment 6 and with latest master build.

@Jeremie Laval, please review the screencast and let me know is it sufficient to close this issue?

Screencast :http://www.screencast.com/t/yVraOjWyp0m

Environment info:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional
Xamarin (edfcb99)
Xamarin.Android (9b342aafa9dade8c5215c1d4bd6e7402559de299)
Xamarin.iOS (dfb682fa615491b012ed24198d2bdcd641e1874f)
Xamarin.iOS Unified Migration   1.0
Comment 9 Jérémie Laval 2015-01-15 14:04:26 UTC
@Arpit I would have put the 2 as Main2.axml to keep the extension but it seems to work too. Also make sure the filesystem has only one of the file (via the file explorer).