Bug 21973 - F# sprintf AOT bug
Summary: F# sprintf AOT bug
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.2.6
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2014-08-08 18:59 UTC by Chris H
Modified: 2015-04-10 08:13 UTC (History)
5 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 Chris H 2014-08-08 18:59:59 UTC
This maybe more of a mono issue than a Xamarin.iOS issue, but here it goes:

sprintf is getting AOTed incorrectly past 5 arguments

when run in aot-only it attempts to jit and crashes (on the device in my case)

this used to work pre 7.2.6

Sample code:
Console.WriteLine(sprintf "%s %s %s %s" "1" "2" "3" "4") //S'all good
Console.WriteLine(sprintf "%s %s %s %s %s" "1" "2" "3" "4" "5") //Kablamo

InnerException	{System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_object_object_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 }	System.ExecutionEngineException

My Current Machine Setup:

Xamarin Studio
Version 5.2 (build 386)
Installation UUID: 1e982c43-58bf-4cd9-b711-592ef91dc026
Runtime:
	Mono 3.4.0 ((no/c3fc3ba)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000204

Apple Developer Tools
Xcode 5.1.1 (5085)
Build 5B1008

Xamarin.iOS
Version: 7.2.6.28 (Indie Edition)
Hash: 606f31a
Branch: 
Build date: 2014-08-01 15:27:48-0400


Build Information
Release ID: 502000386
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d
Build date: 2014-08-04 14:03:28-04
Xamarin addins: 2b5a5c26ac2ee74c6e91a8d24ef44d0ca9cb74d0

Operating System
Mac OS X 10.9.4
Darwin 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 1 Udham Singh 2014-08-11 07:24:41 UTC
I have checked this issue and observed that when we try to use 5 arguments in sprintf then it is throwing error with device, while it is working fine with simulator. To reproduce this issue I have followed the steps mentioned below : 

1. Create a F# iOS 'Single View Application'.
2. Implement the code p[provided in bug description.
3. Run and debug the application.

Screencast : http://www.screencast.com/t/sTvSPl8l3ZP

Error Log : https://gist.github.com/Udham1/597ac438cbb85d117657
Application Output : https://gist.github.com/Udham1/7ba7e00036893fb8f828
iOS Device Log : https://gist.github.com/Udham1/cd6d8520f70da8472ec6
Ide Log : https://gist.github.com/Udham1/52a54c911266d28141da

Environment Info : 

=== Xamarin Studio ===

Version 5.2 (build 386)
Installation UUID: 952292e8-1484-4c56-b664-6ff701bef591
Runtime:
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.2.6.28 (Business Edition)
Hash: 606f31a
Branch: 
Build date: 2014-08-01 15:27:48-0400

=== Build Information ===

Release ID: 502000386
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d
Build date: 2014-08-04 14:03:28-04
Xamarin addins: 2b5a5c26ac2ee74c6e91a8d24ef44d0ca9cb74d0

=== Operating System ===

Mac OS X 10.9.3
Darwin Xamarin76s-Mac-mini.local 13.2.0 Darwin Kernel Version 13.2.0
    Thu Apr 17 23:03:13 PDT 2014
    root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
Comment 2 Sebastien Pouliot 2014-08-11 09:13:05 UTC
Zoltan, can you have a look ? thanks
Comment 3 Zoltan Varga 2014-08-13 15:18:05 UTC
Fixed in mono master e46452652f713acf8fa1d064e0717439907b6359.
Comment 4 Sebastien Pouliot 2014-08-14 20:10:47 UTC
Closing so it can be verified by QA against a master build. I'll see if this can be backported to 7.4 once verified.
Comment 5 Masahiko Miyasaka 2015-04-03 01:02:06 UTC
I encountered this problem yesterday.
My iOS project is written by C# and it references F# PCL
project.
This works fine on simulator but crash on device.
My F# project uses sprintf with 6 args.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2015-04-10 08:13:00 UTC
@Masahiko, I can't reproduce any problems with the instructions you provide; can you create a test project we can use to reproduce it? Preferably also create a new bug report, in case it's a different underlying issue.