Bug 26002 - UIView.PointInside parameters bug [x86_64 / simulator only]
Summary: UIView.PointInside parameters bug [x86_64 / simulator only]
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 8.6.x (services rel)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2015-01-14 05:05 UTC by Eugene Gubin
Modified: 2015-01-27 12:38 UTC (History)
6 users (show)

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

Sources (356.79 KB, application/zip)
2015-01-14 07:15 UTC, Eugene Gubin
smaller test case (17.69 KB, application/zip)
2015-01-14 09:36 UTC, Sebastien Pouliot

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 Eugene Gubin 2015-01-14 05:05:17 UTC
UIView.PointInside has point parameter. In x86_64 mode (iOS Simulator, 64bit) point.Y is zero always.

Steps to reproduce:
1. Open CGPoint_64bit_bug project.
2. Run it on iOS Simulator (iPhone 5s, iOS 7.1 for example).
3. Tap somewhere on red view.
4. See in console what point.Y is ok.
5. Uncomment code in TestView class.
6. Repeat steps 1-3.

Result: point.Y is zero always.
Comment 1 Udham Singh 2015-01-14 06:30:34 UTC
We have tried to reproduce this issue but not able to reproduce this. Could you please us a sample project that demonstrate this issue? So that we can reproduce this issue at our end.

Also please provide your build info and application output. You can get build info via 'Xamarin Studio > About Xamarin Studio > Show Details > Copy Info and paste it here'.

Comment 2 Eugene Gubin 2015-01-14 07:15:06 UTC
Created attachment 9348 [details]

Comment 3 Eugene Gubin 2015-01-14 07:19:14 UTC
It seems I forgot to add sources. Here is info about Xamarin environment http://pastebin.com/8t95mdwC Hope it help you.
Comment 4 Sebastien Pouliot 2015-01-14 09:30:55 UTC
That seems to happen only on x86_64 (simulator) while it works fine on device (arm64). It could be an ABI issue, c.c. Zoltan

Also there's no need for the native library to be used to duplicate the issue.
Comment 5 Sebastien Pouliot 2015-01-14 09:36:27 UTC
Created attachment 9350 [details]
smaller test case
Comment 6 Eugene Gubin 2015-01-14 09:44:04 UTC
Native library was added to investigate and illustrate source of issue. It's
not mandatory.
Comment 7 Zoltan Varga 2015-01-14 22:39:05 UTC
This seems to work if the method is called from managed code, what calls it from native code ?
Comment 8 Sebastien Pouliot 2015-01-14 23:27:08 UTC
It's a virtual Obj "method" overridden in managed code, so it's iOS that's calling the view. It could also be a incorrect trampoline (c.c. Rolf) not code generated by mono.
Comment 9 Zoltan Varga 2015-01-14 23:45:21 UTC
Looking at this with gdb, the problem seems to be earlier, i.e.:

#0  0x00000001208ebb8a in ?? ()
#1  0x000000010748d8b9 in mono_jit_runtime_invoke () at ../../../../../mono/mono/mini/mini.c:6735
#2  0x000000010752164e in mono_runtime_invoke (method=0x7fb0cc1fe028, obj=0x12002c200, params=0x7fff5885dc30, exc=0x0) at ../../../../../mono/mono/metadata/object.c:2842
#3  0x00000001075e2c9d in xamarin_invoke_trampoline (type=Tramp_Default, self=0x7fb0cd753020, sel=0x11a780b17, iterator=0x1075e3cf0 <param_iter_next>, marshal_return_value=0x1075e3f90 <marshal_return_value>, context=0x7fff5885e0b8) at trampolines-invoke.m:343
#4  0x00000001075e3ce1 in xamarin_arch_trampoline (state=0x7fff5885e100) at trampolines-x86_64.m:526
#5  0x00000001075e3b7a in xamarin_x86_64_common_trampoline () at trampolines-x86_64-asm.s:57
#6  0x00000001094ded11 in -[UIView(Geometry) hitTest:withEvent:] ()

The mono_runtime_invoke () function receives a pointer to the CGPoint structure in params [0], which
looks like this:
x/2gf 0x00007fff5885dc40
0x7fff5885dc40:	147.5	0

So it looks like the second field of CGPoint is already zero by this point.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2015-01-16 12:45:11 UTC
This is a bug in the 64-bit dynamic registrar.

A workaround is to add "--registrar:static" to the additional mtouch arguments in the project's iOS Build options.
Comment 11 Rolf Bjarne Kvinge [MSFT] 2015-01-16 13:25:33 UTC

maccore/master: 19b0051d59594bb5c662ddf60db745c9b95ce5ad
monotouch/master: fb3b5d754bd7bee0ec73b9764f195a8944be295b
Comment 12 Rolf Bjarne Kvinge [MSFT] 2015-01-16 13:26:42 UTC
Reopening since it's a candidate for the 8.6.1 service release.
Comment 13 Sebastien Pouliot 2015-01-19 17:57:59 UTC
Backported to monotouch-8.6.8-branch for the service release
Comment 14 Shruti 2015-01-20 02:36:22 UTC
I have verified this issue with attached sample project. It is working fine. Point.Y is giving expected results. Hence, closing this issue.

Screencast :

Environment Info:
=== Xamarin Studio ===

Version 5.7.1 (build 14)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.2 (6758)
Build 6C107a

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: d8e6436
Build date: 2015-01-18 17:38:20-0500

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	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.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.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 507010014
Git revision: a4dd61ad7f8b3695be4b17bcb5c3ae6b81438cf7
Build date: 2015-01-19 15:21:09-05
Xamarin addins: 081208fe3bbf40e24a562867c6c7fba20a9b94b6

=== Operating System ===

Mac OS X 10.10.0
Darwin XamnewiMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 16 Sebastien Pouliot 2015-01-20 16:57:17 UTC
Build (for tests) fixed in 1190990c71d62afaf18b269e8c92edd156d1860e
Comment 17 GouriKumari 2015-01-27 12:38:15 UTC
The issue is fixed with 1190990c71d62afaf18b269e8c92edd156d1860e and verified with build  3b3ef438. Also, the original issue is already verified fixed and hence closing this bug.

Screencast: http://screencast.com/t/fs1Hw4YKewiN
Build Log: https://wrench.internalx.com/Wrench/GetFile.aspx?id=4936674

Test Env: