Bug 22711 - F# Code: Attempting to JIT compile method 'System.Array:qsort<string, int> (string[],int[],int,int,System.Collections.Generic.IComparer`1<string>)' while running with --aot-only.
Summary: F# Code: Attempting to JIT compile method 'System.Array:qsort<string, int> (s...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 8.0.0 (iOS 8)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-05 16:59 UTC by Will Smith
Modified: 2014-12-16 21:00 UTC (History)
6 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Will Smith 2014-09-05 16:59:59 UTC
Just recently updated Mono to 3.8 for my company's F# application. When I attempt to run the application in Debug on an actual device, I get this exception:

"
Attempting to JIT compile method 'System.Array:qsort<string, int> (string[],int[],int,int,System.Collections.Generic.IComparer`1<string>)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
"

This happens particularly on every single sort method I call. If I run in Release, the application will crash. This did not happen the previous version of Mono. This is a serious showstopper right now.

Here is example code to reproduce the issue (be sure to test on actual device):

AppDelegate.fs
---
namespace iPadTest

open System
open MonoTouch.UIKit
open MonoTouch.Foundation

type LeaseItem = { Id: int; Name: string; NetGross: decimal }

[<Register("AppDelegate")>]
type AppDelegate() = 
    inherit UIApplicationDelegate()
    member val Window = null with get, set
    // This method is invoked when the application is ready to run.
    override this.FinishedLaunching(app, options) = 
        this.Window <- new UIWindow(UIScreen.MainScreen.Bounds)
        this.Window.RootViewController <- new iPadTestViewController()
        this.Window.MakeKeyAndVisible()

        let stuff = [{ LeaseItem.Name = ""; LeaseItem.Id = 0; NetGross = 0m };{ LeaseItem.Name = ""; LeaseItem.Id = 0; NetGross = 0m }]  |> List.map (fun x -> x)
        let items = (stuff |> List.sortBy (fun x -> x.Name.ToUpper()))

        printfn "%A" items

        true

module Main = 
    [<EntryPoint>]
    let main args = 
        UIApplication.Main(args, null, "AppDelegate")
        0
Comment 1 Will Smith 2014-09-05 17:35:10 UTC
Clarification, this happens on F#'s List.sort/List.sortBy, Seq.sort, Seq.sortBy with anything that requires IComparer
Comment 2 Will Smith 2014-09-05 18:59:24 UTC
I apologize, supposed to remove the ViewController bit.

AppDelegate.fs
--
namespace iPadTest

open System
open MonoTouch.UIKit
open MonoTouch.Foundation

type LeaseItem = { Id: int; Name: string; NetGross: decimal }

[<Register("AppDelegate")>]
type AppDelegate() = 
    inherit UIApplicationDelegate()
    member val Window = null with get, set
    // This method is invoked when the application is ready to run.
    override this.FinishedLaunching(app, options) = 
        this.Window <- new UIWindow(UIScreen.MainScreen.Bounds)
        this.Window.MakeKeyAndVisible()

        let stuff = [{ LeaseItem.Name = ""; LeaseItem.Id = 0; NetGross = 0m };{LeaseItem.Name = ""; LeaseItem.Id = 0; NetGross = 0m }]  |> List.map (fun x ->x)
        let items = (stuff |> List.sortBy (fun x -> x.Name.ToUpper()))

        printfn "%A" items

        true

module Main = 
    [<EntryPoint>]
    let main args = 
        UIApplication.Main(args, null, "AppDelegate")
        0
Comment 3 Zoltan Varga 2014-09-06 00:40:05 UTC
Fixed in mono f8365f7900909a4ee900a1a905c77fe3225bf4ce.
Comment 4 Miguel de Icaza [MSFT] 2014-09-08 15:18:23 UTC
Zoltan,

Can this patch be backported to the 3.8.0 branch, which is what we are using for the ios8 relase?
Comment 5 Sebastien Pouliot 2014-09-09 09:24:08 UTC
That was backported to mono-3.8.0-branch in 0806328b0447ca6a467ba5727a799e5665d43025
and ios8-7.4.0 was bumped in eaebeacc265913c9b1b2fee00ae6ec9ab0ccfd2d
Comment 7 Will Smith 2014-09-09 12:48:07 UTC
Mono JIT compiler version 3.8.0 ((no/45d0ba1 Tue Aug 26 20:33:43 EDT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.4svn-mono-(no/e656cac)
	GC:            sgen

Xamarin Studio
Version 5.3 (build 440)
Installation UUID: 50bda722-5885-4311-ad70-e92a9e0fcac4
Runtime:
	Mono 3.8.0 ((no/45d0ba1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000009

Apple Developer Tools
Xcode 5.1.1 (5085)
Build 5B1008

Xamarin.Mac
Version:

Xamarin.iOS
Version: 7.4.0.108 (Business Edition)
Hash: 77efa3f
Branch: 
Build date: 2014-08-26 07:59:55-0400

Xamarin.Android
Not Installed

Build Information
Release ID: 503000440
Git revision: accb55419539e512cff857b14b80ec3107996511
Build date: 2014-09-01 08:53:05-04
Xamarin addins: 6dbac4b3a32df080bf98cde838ce89e573a92859

Operating System
Mac OS X 10.9.2
Darwin Wills-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 8 Ram Chandra 2014-09-18 09:07:09 UTC
I am able to reproduce this issue with following builds:  

Xamarin Studio: 5.3 (build 441)
Xamarin.iOS : 7.4.0.108 (Enterprise Edition)

Screencast: http://www.screencast.com/t/10GRnU8xt

To verify this issue, I have checked this issue with following builds:

Mac OS X 10.9.4
Xamarin Studio:5.4 (build 240)
Runtime:
	Mono 3.8.0 ((no/45d0ba1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000009

=== Apple Developer Tools ===

Xcode 6.0 (6299)
Build 6A313

=== Xamarin.iOS ===

Version: 8.0.0.61 (Enterprise Edition)
Hash: 08a3f6f
Branch: 
Build date: 2014-09-17 18:23:53-0400

=== Build Information ===

Release ID: 504000240
Git revision: 01786bc67c7024ec33d327ed27e4416d7a846f4e
Build date: 2014-09-17 10:58:48-04
Xamarin addins: 7cd7dfcd6b7b7b53281508954ec080f1cd153ad3

Now, I am not getting any exception/error when I try to deploy F# application which is using sort method. I have checked the same on both device and simulator. It is working fine on both device and simulator.

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

This issue has been fixed. Hence, I am closing this issue.
Comment 9 Will Smith 2014-12-16 20:54:53 UTC
This bug is back again.

Xamarin.iOS
Version: 8.4.0.47 (Business Edition)
Hash: 7244769
Branch: 
Build date: 2014-12-11 14:54:30-0500

Build Information
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

Operating System
Mac OS X 10.9.5
Darwin Wills-MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 10 Will Smith 2014-12-16 21:00:43 UTC
But this appears to be fixed in beta.

Apple Developer Tools
Xcode 6.0.1 (6528)
Build 6A317

Xamarin.iOS
Version: 8.6.0.32 (Business Edition)
Hash: f31ad46
Branch: 
Build date: 2014-12-12 17:56:03-0500

Xamarin.Mac
Not Installed

Build Information
Release ID: 507000652
Git revision: 042e44ba92a6a9c46bd2b69b0b4348df43f381ea
Build date: 2014-12-11 18:37:24-05
Xamarin addins: 06d3aaafde7f726d508e079c9b297cc9aae4af55

Operating System
Mac OS X 10.9.5
Darwin Wills-MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64