Bug 27540 - ExecutionEngineException: Attempting to JIT compile method when calling failwithf from F# code
Summary: ExecutionEngineException: Attempting to JIT compile method when calling failw...
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime (show other bugs)
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-01 20:04 UTC by Frank A. Krueger
Modified: 2017-08-02 20:53 UTC (History)
6 users (show)

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


Attachments
Project that repros the error on the phone (22.89 KB, application/zip)
2015-03-01 20:06 UTC, Frank A. Krueger
Details

Description Frank A. Krueger 2015-03-01 20:04:04 UTC
The following code causes a JIT error.

    member private a.Mess (b : Matrix) =
        if a.NumRows <> b.NumRows || a.NumColumns <> b.NumColumns then
            failwithf "Mismatched matrices: %dx%d vs %dx%d" a.NumRows a.NumColumns b.NumRows b.NumColumns
        else ()

NumRows and NumColumns are private properties.

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_object_object_object_object_object_object_object_object_object_object (object,intptr,intptr,intptr)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114
at Microsoft.FSharp.Core.PrintfImpl+PrintfBuilder`3[Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].buildPlainFinal (System.Object[] args, System.Type[] argTypes) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+PrintfBuilder`3[Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].buildPlain[String] (Int32 numberOfArgs, System.String prefix) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+PrintfBuilder`3[Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].parseFormatString (System.String s, System.Type funcTy) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+PrintfBuilder`3[Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].Build[FSharpFunc`2] (System.String s) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+Cache`4[Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.Unit]]]],Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].generate (System.String fmt) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl.f@4280-44[FSharpFunc`2,Unit,String,Unit] (System.String key, Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+Cache`4[Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.Unit]]]],Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].get (System.String key) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfImpl+Cache`4[Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.Unit]]]],Microsoft.FSharp.Core.Unit,System.String,Microsoft.FSharp.Core.Unit].Get (Microsoft.FSharp.Core.PrintfFormat`4 key) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThen[Unit,FSharpFunc`2] (Microsoft.FSharp.Core.FSharpFunc`2 continutation, Microsoft.FSharp.Core.PrintfFormat`4 format) [0x00000] in <filename unknown>:0
at Microsoft.FSharp.Core.ExtraTopLevelOperators.PrintFormatToStringThenFail[FSharpFunc`2,Unit] (Microsoft.FSharp.Core.PrintfFormat`4 format) [0x00000] in <filename unknown>:0
at Drone.Control.Matrix+Matrix.Mess (Drone.Control.Matrix b) [0x00029] in /Users/fak/Dropbox/Projects/Drone/Drone.Control/Matrix.fs:18
at Drone.Control.Matrix+Matrix.op_Addition (Drone.Control.Matrix a, Drone.Control.Matrix b) [0x00000] in /Users/fak/Dropbox/Projects/Drone/Drone.Control/Matrix.fs:23
at Drone.Control.Ukf+xh_kk1@62.Invoke (Drone.Control.Matrix a, Drone.Control.Matrix s) [0x00000] in /Users/fak/Dropbox/Projects/Drone/Drone.Control/Ukf.fs:62
at Microsoft.FSharp.Collections.ArrayModule.Fold[Matrix,Matrix] (Microsoft.FSharp.Core.FSharpFunc`2 folder, Drone.Control.Matrix state, Matrix[] array) [0x00000] in <filename unknown>:0
at Drone.Control.Ukf+Ukf.Predict () [0x0027f] in /Users/fak/Dropbox/Projects/Drone/Drone.Control/Ukf.fs:57
at Drone.Control.Ukf+Ukf.Update (Drone.Control.Matrix observation) [0x00000] in /Users/fak/Dropbox/Projects/Drone/Drone.Control/Ukf.fs:75
at <StartupCode$Drone-iOS>.$AppDelegate+clo@45.Invoke (CoreMotion.CMAccelerometerData data, Foundation.NSError error) [0x00064] in /Users/fak/Dropbox/Projects/Drone/Drone.iOS/AppDelegate.fs:51
at ObjCRuntime.Trampolines+SDCMAccelerometerHandler.Invoke (IntPtr block, IntPtr data, IntPtr error) [0x00019] in /Developer/MonoTouch/Source/monotouch/src/build/native/ObjCRuntime/Trampolines.g.cs:8550
at (wrapper native-to-managed) ObjCRuntime.Trampolines/SDCMAccelerometerHandler:Invoke (intptr,intptr,intptr)





=== Xamarin Studio ===

Version 5.7.2 (build 7)
Installation UUID: fce13fdd-e8e3-48ef-99f1-4acbb06f0240
Runtime:
	Mono 3.12.0 ((detached/b8f5055)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000077

=== Apple Developer Tools ===

Xcode 6.2 (6753)
Build 6C101

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b23)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b22, mixed mode)

=== Xamarin.iOS ===

Version: 8.6.2.26 (Enterprise Edition)
Hash: 9905782
Branch: 
Build date: 2015-02-26 11:05:07-0500

=== Xamarin.Mac ===

Version: 1.12.0.8 (Enterprise Edition)

=== Build Information ===

Release ID: 507020007
Git revision: dcf3f486177d3e625349b51a8f3be807e3fa7712
Build date: 2015-02-24 09:14:27-05
Xamarin addins: ea7c65bb7876e4a876ab365208e94acdf8f330ef

=== Operating System ===

Mac OS X 10.10.2
Darwin muon.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 1 Frank A. Krueger 2015-03-01 20:06:59 UTC
Created attachment 10102 [details]
Project that repros the error on the phone
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-03-02 03:37:28 UTC
Frank, I get a build error with the project:

	/Users/rolf/Downloads/Bug27540Repro/Drone.Control/Script.fsx(2,1): error FS0078: Unable to find the file 'bin/Debug/Drone.Control.dll' in any of /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS /Users/rolf/Downloads/Bug27540Repro/Drone.Control /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS

and I couldn't find any Drone.Control.dll neither in the zip.
Comment 3 Ian Leatherbury 2015-11-13 14:18:02 UTC
Hey guys, I am also seeing this, but not using failwith.

Exception has been thrown by the target of an invocation.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper unknown) System.Collections.ObjectModel.ObservableCollection`1<tryfsharpforms.DoubleDoubleDataPoint>[]:Get (int)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/2356/3c0ec355/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295

Code is here: https://github.com/ianleatherbury/tryfsharpforms
Comment 4 Ian Leatherbury 2015-11-13 14:19:30 UTC
Ah, also, version info here:

=== Xamarin Studio ===

Version 6.0 (build 1752)
Installation UUID: a94920a1-f856-4824-bfd3-9fdd755e5783
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Version: 0.20.0.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 6.0.0.33 (Enterprise Edition)
Android SDK: /Users/ianl/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)

SDK Tools Version: 24.3.4
SDK Platform Tools Version: 23
SDK Build Tools Version: 23.0.0

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.Mac ===

Version: 2.4.0.109 (Enterprise Edition)

=== Xamarin.iOS ===

Version: 9.2.1.51 (Enterprise Edition)
Hash: 3c0ec35
Branch: master
Build date: 2015-11-12 13:05:39-0500

=== Build Information ===

Release ID: 600001752
Git revision: 82f4627b45b35ff833ffd6fe8dcd8601b595b0a2
Build date: 2015-11-04 11:57:18-05
Xamarin addins: 22dfcd8727ec2315920dc0c22d77470698c2b839
Build lane: monodevelop-lion-roslyn

=== Operating System ===

Mac OS X 10.11.1
Darwin ianl-mac-old-2.local 15.0.0 Darwin Kernel Version 15.0.0
    Sat Sep 19 15:53:46 PDT 2015
    root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Comment 5 Mikayla Hutchinson [MSFT] 2015-11-13 14:22:37 UTC
.
Comment 6 Ian Leatherbury 2015-11-13 14:34:05 UTC
For me, this is working fine on Simulator. Only getting the runtime error when deployed to device.
Comment 7 Dave Thomas 2015-11-13 16:14:01 UTC
Some sort of generic limitation of AOT maybe?

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