This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44144 - Cannot open axml files using Layout Editor
Summary: Cannot open axml files using Layout Editor
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Designer (show other bugs)
Version: 6.1.0 (C8)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: (C8SR1)
Assignee: Jérémie Laval
URL:
Depends on:
Blocks:
 
Reported: 2016-09-09 14:59 UTC by Fabian Alexis Bravo Abarca
Modified: 2016-10-18 09:35 UTC (History)
9 users (show)

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


Attachments
Example project (1.87 MB, application/zip)
2016-09-15 15:15 UTC, Fabian Alexis Bravo Abarca
Details
Windows log file (34.55 KB, text/plain)
2016-10-17 19:34 UTC, jellevreeker
Details

Description Fabian Alexis Bravo Abarca 2016-09-09 14:59:53 UTC
Description of Problem:


Steps to reproduce the problem:
1. Create a new axml file in Resources/layout folder (Android xamarin project)
2. Open it using "Layout Editor"
3. A message appears telling that the axml file couldn't be opened.


Actual Results:
Axml cannot be opened using Layout Editor


Expected Results:
Layout editor should open any axml file.

How often does this happen? 
Always


Additional Information:

Logs : 
ERROR [2016-09-09 11:21:43Z]: The file '/Users/---/---/---/Droid/Resources/layout/Main.axml' could not be opened.
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.AndroidDesigner.AndroidDesignerSession.RebuildCustomComponentsList () [0x00107] in /Users/builder/data/lanes/3509/bc95b787/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:771 
  at Xamarin.AndroidDesigner.AndroidDesignerSession..ctor (Xamarin.AndroidDesigner.Java.JavaProcessConnection connection, Xamarin.AndroidDesigner.DesignerProject project) [0x001d1] in /Users/builder/data/lanes/3509/bc95b787/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:255 
  at Xamarin.AndroidDesigner.DesignerProject.CreateSession () [0x00017] in /Users/builder/data/lanes/3509/bc95b787/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerProject.cs:452 
  at MonoDevelop.MonoDroid.Designer.AndroidDesignerView+<Load>c__async0.MoveNext () [0x002b7] in /Users/builder/data/lanes/3509/bc95b787/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Designer/AndroidDesignerView.cs:148 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Ide.Gui.LoadFileWrapper+<Invoke>c__async0.MoveNext () [0x00161] in /Users/builder/data/lanes/3509/bc95b787/source/monodevelop/main/src/core/MonoDevelop.Ide/
Comment 1 Jérémie Laval 2016-09-14 16:20:33 UTC
Hello Fabian,

Is it possible for you to share the project that causes this? Thanks.
Comment 2 edgar 2016-09-15 06:27:23 UTC
I have the same issue. Was on the beta channel when it happened, then reverted back to stable where it still worked, now updated to 6.1 and it happens in the stable channel as well.
Comment 3 Jiri Banas 2016-09-15 12:58:30 UTC
On macOS, I deleted all Xamarin folders from this path '/Users/<your-user-name>/Library/Caches' and restarted Xamarin Studio. The layout editor now opens.
Comment 4 Fabian Alexis Bravo Abarca 2016-09-15 15:04:24 UTC
Hello Jérémie,

Sure, I was just starting a new project. But I downgraded Xamarin same as Jiri, and also did the folder trick, but after a while that trick didn't work.
Now with the latest update I can open axml files and it works fine. I don't know if the stable version was the same as the one in the beta channel.

Anyway, I'm going to put my project here.
Comment 6 Jiri Banas 2016-09-15 15:16:53 UTC
Just for clarity. I am using the latest stable release of Xamarin Studio (6.1 (build 5441)) and Xamarin Android (7.0.0.18). The trick with deleting the caches folder worked but after a while the issue reoccurs. Again deleting the caches fixes it for the time being.
Comment 7 Jérémie Laval 2016-09-19 19:25:39 UTC
Thanks folks, I'll try to see if I can reproduce.
Comment 8 Jérémie Laval 2016-09-20 17:23:08 UTC
I couldn't reproduce the issue triggering that initial stacktrace with your project Fabian but I found and fixed an issue due to ViewAnimator subclasses (like ViewFlipper) that would prevent the layout from loading (in your case LoginLanding.axml)

@Jiri and Edgar, could you guys include your own logs and/or projects where you can reproduce that issue? Thanks
Comment 9 Jiri Banas 2016-09-21 10:35:34 UTC
@Jeremie, this is from my IDE log when the exception occurs:

ERROR [2016-09-15 06:05:59Z]: The file '/Users/jiri/Desktop/TestProject/Resources/Layout/GenericList.axml' could not be opened.
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.AndroidDesigner.AndroidDesignerSession.RebuildCustomComponentsList () [0x00107] in /Users/builder/data/lanes/3509/68292d1a/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:771 
  at Xamarin.AndroidDesigner.AndroidDesignerSession..ctor (Xamarin.AndroidDesigner.Java.JavaProcessConnection connection, Xamarin.AndroidDesigner.DesignerProject project) [0x001d1] in /Users/builder/data/lanes/3509/68292d1a/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:255 
  at Xamarin.AndroidDesigner.DesignerProject.CreateSession () [0x00017] in /Users/builder/data/lanes/3509/68292d1a/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerProject.cs:452 
  at MonoDevelop.MonoDroid.Designer.AndroidDesignerView+<Load>c__async0.MoveNext () [0x002b7] in /Users/builder/data/lanes/3509/68292d1a/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Designer/AndroidDesignerView.cs:148 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Ide.Gui.LoadFileWrapper+<Invoke>c__async0.MoveNext () [0x00161] in /Users/builder/data/lanes/3509/68292d1a/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:1551 


ERROR [2016-09-15 06:06:07Z]: GLib-Critical: gboolean g_str_has_prefix(const gchar *, const gchar *): assertion `str != NULL' failed
Stack trace: 
  at Gtk.Application.gtk_main () [0x00000] in <c304d993b5dc4262b01bb4b1f75ba84a>:0 
  at Gtk.Application.Run () [0x00000] in <c304d993b5dc4262b01bb4b1f75ba84a>:0 
  at MonoDevelop.Ide.IdeApp.Run () [0x00000] in /Users/builder/data/lanes/3509/68292d1a/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs:386 
  at MonoDevelop.Ide.IdeStartup.Run (MonoDevelop.Ide.MonoDevelopOptions options) [0x00760] in /Users/builder/data/lanes/3509/68292d1a/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:283 
  at MonoDevelop.Ide.IdeStartup.Main (System.String[] args, MonoDevelop.Ide.Extensions.IdeCustomizer customizer) [0x0009e] in /Users/builder/data/lanes/3509/68292d1a/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:594 
  at Xamarin.Startup.MainClass.Main (System.String[] args) [0x00000] in /Users/builder/data/lanes/3509/68292d1a/source/md-addins/Xamarin.Startup/Main.cs:11
Comment 10 Ruben Macias 2016-09-27 20:04:07 UTC
Hi Jeremine,

I am running into the same issue as the rest.  However, I have been able to re-create the issue consistently. I think it has to do with having Multi-Dex enabled on our app.  Here's the steps I perform.

1.  Open our app in Xamarin Studio.
2.  Double click any *.axml file.
3.  Error message appears with same logs as stated above.
4.  Disable Multi-Dex from the Android Project Properties.
5.  Close and Restart Xamarin Studio (this is important).
6.  Open any *.axml file.
7.  The designer opens successfully.
8.  Re-enable MultiDex from Project Properties.
9.  Restart Xamarin Studio.
10. Open any *.axml file.
11. Error comes back.

I'll try to create a sample project and attach it here when I have a chance.
Comment 11 Miguel de Icaza [MSFT] 2016-10-03 18:05:17 UTC
New data
Comment 12 Alan McGovern 2016-10-04 16:26:35 UTC
I can't compile this project and neither could Jeremie when he worked on this before.

What combination of our software are you using to successfully compile this with Xamarin Stuidio? Do you have a simpler testcase which we can use to reproduce the issue?
Comment 13 Fabian Alexis Bravo Abarca 2016-10-05 14:14:12 UTC
Hello Alan,

I was just starting a project using the latest android version at that moment, plus : 

- Realm
- CartoDB Maps
- Newtonsoft JSON
- Refit
- Xamarin Auth

Realm installs Fody too, that was causing some problem at the beginning, but that's related to building the project. Rebuilding fixed that.

Using the beta this bug appeared even with a completely new and empty AXML file.
Comment 14 Alan McGovern 2016-10-05 16:07:05 UTC
Can you attach the full logs instead of just a snippet from them? There's more logging in the complete file which could help explain the issue. The issue is unfortunately still not reproducible by us.

The only reproducible problem is the issue noted in comment 8. The fix for that is currently scheduled to be part of the next major release.
Comment 15 Alan McGovern 2016-10-06 12:53:06 UTC
The full log files associated with the original issue would be great to have.

In the meantime there is a build I would like you to test with, if you can. It should handle this case gracefully and not prevent the file from opening. If the issue is triggered there will additional logging statements which will help diagnose it, so if you could run through the steps to trigger the problem and attach the logs new logs that would be great.

If it does not help, we would need the full logs as generated by the new build.

New XS build: http://files.xamarin.com/~alan/XamarinStudio-6.1.2.9.dmg

I'll de-list this build once you have verified whether or not it helps you.
Comment 16 Fabian Alexis Bravo Abarca 2016-10-06 14:17:55 UTC
I'm going to try this new build. Anyway, at least for me, once I updated the production version of xamarin I was able to open axml files, except for the bug fixes in comment #8.

Give me a few hours to try it...
Comment 17 Fabian Alexis Bravo Abarca 2016-10-07 13:23:23 UTC
Hello again Alan,

Using your build, I was able to open all my axml files. I'm going to continue using it for a while, and post here if I come across any problem or the same bug.
As I said, I had this problem with the beta version. I don't know if the people with the same problem here can test this build and check if they're able to open their axml files.

Thanks Alan!
Comment 18 Ruben Macias 2016-10-07 13:50:05 UTC
I can also confirm that the build in Comment #15 is able to open my *.axml files as well.  Sorry for the late response as we had a huge release last week.  I was also able to create a test project to reproduce the issue.  The test project also works on the build in Comment #15 too.  Thanks for the hard work!
Comment 19 Jérémie Laval 2016-10-10 16:27:42 UTC
We have merged the workaround in our release branches, it will be part of the next service release.

It would still be helpful if you could share your logs even with the working version so that we can try to identify why this issue crept up in the first place.

Thanks!

PS: I'll mark this issue as RESOLVED for now for release tracking but feel free to continue updating this bug with more info or reopen it if you experience the issue again.
Comment 20 xamarin-release-manager 2016-10-10 17:12:22 UTC
Fixed in version 6.1.2.28 (cycle8)

Author: J??r??mie Laval
Commit: 4044d39a2a8f974ad9f13f4e5862068c700f9d5b (xamarin/md-addins)
Included in Commit: 78d0488cdef9edd080b66f0c0c8dc94e90cba203 (mono/monodevelop)
Comment 22 Jiri Banas 2016-10-14 09:47:06 UTC
I am using the build that Alan posted in comment no. 15 and the issue still exists, however it doesn't error on all layout files anymore, but only on a random selection of those. I couldn't share my feedback sooner because I was working on another non-Xamarin project.

This is the output of my IDE log for the error:

ERROR [2016-10-14 05:41:23Z]: The file '/Users/jiri/Desktop/DroidTestProject/layout/ProductListItem.axml' could not be opened.
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.AndroidDesigner.UpdateConflict.Unscape (System.String s) [0x00000] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/UpdateConflict.cs:134 
  at Xamarin.AndroidDesigner.PropertyChangeConflict.ParseChangeString (System.String s) [0x000f1] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/UpdateConflict.cs:317 
  at Xamarin.AndroidDesigner.UpdateConflict.ParseConflict (System.Collections.Generic.IEnumerable`1[T] layouts, System.String s) [0x00217] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/UpdateConflict.cs:226 
  at Xamarin.AndroidDesigner.LayoutInfo.ParseConflicts (System.Collections.Generic.IEnumerable`1[T] layouts) [0x00034] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/LayoutInfo.cs:215 
  at Xamarin.AndroidDesigner.AndroidDesignerSession.LoadFile (System.String layoutPath, System.String newXmlContent) [0x001ee] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:396 
  at Xamarin.AndroidDesigner.AndroidDesignerSession.LoadFile (System.String layoutPath) [0x00000] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:352 
  at MonoDevelop.MonoDroid.Designer.AndroidDesignerView+<Load>c__async0.MoveNext () [0x00312] in /Users/builder/data/lanes/3900/24babe40/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Designer/AndroidDesignerView.cs:154 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-4.6.0-c8sr0/bockbuild-mono-4.6.0-branch-c8sr0/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at MonoDevelop.Ide.Gui.LoadFileWrapper+<Invoke>c__async0.MoveNext () [0x00161] in /Users/builder/data/lanes/3900/24babe40/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:1551
Comment 23 Alan McGovern 2016-10-14 09:50:05 UTC
Would you be able to attach the whole log file? There can be relevant information earlier in the file which we would need to solve the problem properly. Thanks!
Comment 24 jellevreeker 2016-10-17 19:31:36 UTC
I have the same issue in the windows version 6.1.1 build 15. No axml file will open in the designer.
Comment 25 jellevreeker 2016-10-17 19:34:13 UTC
Created attachment 18091 [details]
Windows log file
Comment 26 Alan McGovern 2016-10-18 09:31:29 UTC
Could you attach a copy of the project which triggers this new issue to bug report? Bear in mind this is a public bug and everyone already on the CC will see any additional private comments. If it's not OK to share it publicly, could you send a copy to me directly?

I just want to be sure we completely solve all the issues before we mark this bug as fixed again.
Comment 27 Alan McGovern 2016-10-18 09:35:53 UTC
Oh, sorry! This is not a new issue, it is the issue we fixed already. I've already taken down the temporary link in comment 15 so you won't be able to grab that build to verify your issue is gone. However we should be shipping a new cycle8 build in the not too distant future which will contain this patch.

Note You need to log in before you can comment on or make changes to this bug.