Bug 29970 - [MonoNativeFunctionWrapper] doesn't work with methods that return structures on 32bit device
Summary: [MonoNativeFunctionWrapper] doesn't work with methods that return structures ...
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.10
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2015-05-12 09:11 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2015-05-29 09:26 UTC (History)
5 users (show)

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

Test case (9.39 KB, application/zip)
2015-05-12 09:11 UTC, Rolf Bjarne Kvinge [MSFT]
bug29970.zip (9.39 KB, application/zip)
2015-05-27 10:41 UTC, Rolf Bjarne Kvinge [MSFT]
bug29970-b.zip (9.48 KB, application/zip)
2015-05-29 06:17 UTC, Rolf Bjarne Kvinge [MSFT]

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 Rolf Bjarne Kvinge [MSFT] 2015-05-12 09:11:46 UTC
Created attachment 11162 [details]
Test case

* Run the attached test project on device (in 32-bit mode).

> Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_bound_CGSize_intptr&_intptr_intptr_intptr (intptr,intptr,intptr)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

If SizeWithAttributesDelegate is modified to return void, this exception does not occur (but obviously the test project crashes just after, since the arguments end up all wrong).
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-05-12 09:12:19 UTC
@Zoltan, can you have a look?
Comment 2 Zoltan Varga 2015-05-14 12:38:33 UTC
Fixed in mono master e9931382272870b086401d726147f59ea72a696e.
Comment 4 v7d 2015-05-26 15:46:51 UTC
What is the expected release for this fix?
Comment 7 Shruti 2015-05-27 09:16:52 UTC
Before verify, I need to reproduce this issue so I have deployed attached Test case sample project on 4S 32 bit device. It is deploying successfully on device and displaying text 'here is a test'. 

I have tried it with X.iOS,,

Can you please let me know how I can able to reproduce this issue.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2015-05-27 10:41:13 UTC
Created attachment 11358 [details]

@Shruti, can you try this project instead?
Comment 9 Shruti 2015-05-27 10:58:03 UTC
I have tried again with project given in comment(8), unfortunately still not able to reproduce it. I used X.iOS, to reproduce this issue.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2015-05-27 11:01:28 UTC
@Shruti, That's very strange, I have and the app crashes on startup on my iPad Air (Debug configuration). Can you make sure you clean the solution between each XI re-install?
Comment 11 Rolf Bjarne Kvinge [MSFT] 2015-05-28 04:55:51 UTC
@Sebastien, can you try the project in comment 8 on device and see if it crashes for you at launch?
Comment 12 Sebastien Pouliot 2015-05-28 09:13:43 UTC
With 8.10.1 (macios-cycle5's head) on an iPod Touch 5th gen (32bits) I get this:

2015-05-28 09:08:20.233 MethodSwizzle[1000:432606] Unhandled managed exception:
Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_bound_CGSize_intptr&_intptr_intptr_intptr (intptr,intptr,intptr)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
  at MethodSwizzle.Application.newSizeWithAttributes (IntPtr self, IntPtr sel, IntPtr dictionary) [0x00054] in /Users/poupou/Downloads/bug29970/Main.cs:166 
  at (wrapper native-to-managed) MethodSwizzle.Application:newSizeWithAttributes (intptr,intptr,intptr)
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/poupou/git/xamarin/maccore/src/UIKit/UIApplication.cs:63 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/poupou/git/xamarin/maccore/src/UIKit/UIApplication.cs:46 
  at MethodSwizzle.Application.Main (System.String[] args) [0x0001c] in /Users/poupou/Downloads/bug29970/Main.cs:26 

which is identical to the first reported exception.
Comment 13 Rolf Bjarne Kvinge [MSFT] 2015-05-28 09:21:45 UTC
@Shruti, can you try removing the app from the device before cleaning the solution and running again?
Comment 14 Rolf Bjarne Kvinge [MSFT] 2015-05-29 06:17:24 UTC
Created attachment 11385 [details]

@Shruti, can you try this test project now?

If it still doesn't fail, please get the output in the Application Output (nothing else is needed).
Comment 15 Shruti 2015-05-29 09:26:36 UTC
First I have reproduced this issue with attached project bug29970-b using X.iOS . Getting exception when application is launched.  Here is the screencast for same : http://www.screencast.com/t/jiWDmffK8

Then I have verified this issue with X.iOS Now it is working fine with this build. I am able to deploy and launch the app successfully.
Screencast regarding same:  http://www.screencast.com/t/NiR3KXE9De8

Environment Info:
=== Xamarin Studio ===

Version 5.9.2 (build 2)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 41e42d6
Branch: master
Build date: 2015-05-26 15:31:07-0400

=== Build Information ===

Release ID: 509020002
Git revision: 43735a4b905b571f69cf9428a3ea7b52aef55476
Build date: 2015-05-18 09:38:12-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

=== Operating System ===

Mac OS X 10.10.3
Darwin XamnewiMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64