Bug 39695 - F# Android project no longer loads after adding new layout
Summary: F# Android project no longer loads after adding new layout
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-03-16 20:38 UTC by Matthew Orlando
Modified: 2016-05-19 18:31 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 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 Matthew Orlando 2016-03-16 20:38:25 UTC
Visual Studio 2015 update 1, Xamarin beta channel (as of submission date)

Create a new Xamarin Android F# project in Visual Studio
Right-click the Resources\layout folder and choose Add new item
Choose Android layout (axml) and hit ok

Expected result:
The file is added to the folder without complaint

Actual result:
An error appears saying "Object reference not set to an instance of an object."

Afterwards, save the project and open it again.

Expected result:
The project loads

Actual result:
Error: One or more projects in the solution were not loaded correctly. Please see the Output Window for details.
Error: The project 'ListViewTest.fsproj' could not be opened because opening it would cause a folder to be rendered multiple times in the solution explorer. One such problematic item is 'Resources\layout\Row.axml'. To open this project in Visual Studio, first edit the project file and fix the problem.

I tried editing the file per suggestions here: http://stackoverflow.com/a/32609700 to no avail.
Comment 1 Daniel Cazzulino 2016-04-22 18:19:02 UTC
The limitation that files have to be in order when they are placed in folders is a known one in the F# project system.

This has been filed at https://github.com/Microsoft/visualfsharp/issues/1095

The "Object reference not set to an instance of an object." error happens when the designer is being opened. I could reproduce this issue by having an outdated Android SDK and platform-tools. Could you please run the Android SDK Manager and ensure all tools are updated for the latest API level you have installed and try again?

We implemented a fix to avoid throwing that exception that will ship in a future release.

Thanks for reporting the issue!
Comment 2 Matthew Orlando 2016-05-19 18:31:32 UTC
Can you give me any more detail on when this fix might become public?

After updating my SDK tools and moving the entries around in the fsproj, everything is doing exactly as I reported, even with the latest C7 release candidate from yesterday.

I am unable to open either the pre-existing Main.axml or the new one I added in the designer. It just says

Exception of type System.Exception was thrown

I'll see if I can find another existing bug for that.