Bug 43237 - Can't compile F# Array.take for Android
Summary: Can't compile F# Array.take for Android
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.0.99
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-08-10 16:36 UTC by James Moore
Modified: 2016-09-06 15:54 UTC (History)
4 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 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:

Description James Moore 2016-08-10 16:36:26 UTC
Add this simple F# file (I'm calling it Stuff.fs) to an Android F# project:

module Fnord 

open System

let s = Array.empty |> Array.take 1 |> printfn "got: %A"

Now build.  You'll get an error "error FS0039: The value, constructor, namespace or type 'take' is not defined"

The compile line is:

mono /Library/Frameworks/Mono.framework/Versions/4.6.0/lib/mono/4.5/fsc.exe -g --debug:full --noframework --define:DEBUG --define:__XAMARIN_ANDROID_v1_0__ --define:__MOBILE__ --define:__ANDROID__ --define:__ANDROID_1__ --define:__ANDROID_2__ --define:__ANDROID_3__ --define:__ANDROID_4__ --define:__ANDROID_5__ --define:__ANDROID_6__ --define:__ANDROID_7__ --define:__ANDROID_8__ --define:__ANDROID_9__ --define:__ANDROID_10__ --define:__ANDROID_11__ --define:__ANDROID_12__ --define:__ANDROID_13__ --define:__ANDROID_14__ --define:__ANDROID_15__ --define:__ANDROID_16__ --define:__ANDROID_17__ --define:__ANDROID_18__ --define:__ANDROID_19__ --define:__ANDROID_20__ --define:__ANDROID_21__ --define:__ANDROID_22__ --define:__ANDROID_23__ --optimize- --tailcalls- -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/System.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/System.Xml.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/System.Core.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/FSharp.Core.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v6.0/Mono.Android.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Java.Interop.dll -r:/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0//Facades/System.Runtime.dll --target:library --warnaserror:76 --fullpaths --flaterrors --highentropyva- Stuff.fs 

If you compile outside Xamarin Studio, and just remove this element:


The file compiles.
Comment 1 James Moore 2016-08-10 16:36:52 UTC
=== Xamarin Studio Professional ===

Version 6.1 (build 5308)
Installation UUID: 6dc077b1-7f04-4c1c-b481-1dcbb9a8b0a1
	Mono 4.6.0 (mono-4.6.0-branch/0cb79a3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406000127

=== NuGet ===


=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.Mac ===

Version: (Visual Studio Professional)

=== Xamarin.Android ===

Version: (Visual Studio Professional)
Android SDK: /Users/james/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 25.2.1
SDK Platform Tools Version: 24.0.1
SDK Build Tools Version: 24

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Not Installed

=== Xamarin.iOS ===

Version: (Visual Studio Professional)
Hash: 812051e
Branch: cycle8
Build date: 2016-08-08 11:55:31-0400

=== Build Information ===

Release ID: 601005308
Git revision: fc88ad6de0542c292e46960f6b985fd0ba0396f1
Build date: 2016-08-05 12:18:51-04
Xamarin addins: 3ae05a36f1423061f6b50d9c02d21f128fa1c084
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.11.6
Darwin retina.restphone.com 15.6.0 Darwin Kernel Version 15.6.0
    Thu Jun 23 18:25:34 PDT 2016
    root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
Comment 2 Peter Collins 2016-08-11 21:50:58 UTC
@James what happens if you replace the FSharp.Core reference with the latest 4.x version provided via NuGet? That should resolve this specific error judging by my local testing.
Comment 3 Jason Imison 2016-08-11 22:09:39 UTC
The Android templates are going to be updated to use the NuGet version of FSharp.Core soon which will solve this issue.

The templates currently use a version of FSharp.Core which is pretty old and built in house. I think it's roughly equivalent to which doesn't have Array.take but does have Seq.take

In XS, if the path to FSharp.Core isn't specified, then it will look in the same location as mscorlib (which in this case points to the older FSharp.Core) 

To fix this until the new templates come, just reference the NuGet version of FSharp.Core
Comment 4 James Moore 2016-08-12 15:54:19 UTC
Yes, adding 

nuget FSharp.Core

to paket.dependencies fixes this.

(FSharp.Core isn't really an alpha of FSharp.Core itself, it just has alpha support for .Net Core)
Comment 5 Parmendra Kumar 2016-09-01 16:17:21 UTC
I have checked this issue with XS XamarinStudio- and Its working fine.
I have tested this issue on both Windows and Mac XS and its working fine.

Hence closing this issue.
Comment 6 Parmendra Kumar 2016-09-06 15:54:35 UTC
I have checked this issue with latest C8 XS build: XamarinStudio- and observed that its working fine on Windows and Mac XS.

Hence marked this issue Verified.