I spent many hours yesterday working on a new Android layout in Visual Studio Community 2015. I wrote it all in the Source editor, and everything looked great in the Designer. I was even able to build the application and deploy and run it on my phone and see the fruits of my labor there as well.
I left VS running overnight.
Today, I came back. My layout still looked great, but I decided to change one of the button images by replacing the file in the drawables folder. I noticed that the Designer did not reflect the new image, so I figured that I should close the .axml file and re-open it to refresh it. I clicked the "Save" icon in VS to make sure that my latest changes were saved. When I re-opened the .axml file, to my horror, I found that my layout was blank! I went to the Source tab, and all that was in my .axml file was the default code that is generated when you create a new Android Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" />
I checked everywhere to see if there was another copy of all my hard work. I scoured my hard drive, backups, etc, and nope! Even my backup that ran last night contained only that same default generated markup.
Having come to grips with the fact that I lost a whole day's work, I resigned myself to recreating my whole layout again from scratch. To be safe, I decided to do a small test before spending too much time on it. I created a new .axml layout in VS, and added a single comment to the bottom of the file. I saved the file, and made sure that at the bottom of the screen said that it was saved successfully. I then closed the .axml file and reopened it from the solution explorer. I checked the Source tab, and guess what? The comment is gone! I then tried the same test with a new Class (.cs) file. No problem there. The change to the .cs file saved fine.
I then noticed that VS was telling me that there was a new Xamarin update available, so I installed the update, but it didn't fix the problem.
What the heck is going on here???? Why won't it save my .axml files????
-Joe