Bug 31971 - UICollectionViewFlowLayout is not defined error on 64 bit only
Summary: UICollectionViewFlowLayout is not defined error on 64 bit only
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-07-15 10:48 UTC by John Miller [MSFT]
Modified: 2015-07-16 06:54 UTC (History)
4 users (show)

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

Test Case (24.91 KB, application/zip)
2015-07-15 10:48 UTC, John Miller [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 John Miller [MSFT] 2015-07-15 10:48:02 UTC
Created attachment 12040 [details]
Test Case


   UICollectionView is not working properly on 64 bit. An error is logged:

> the behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values.

**Steps to Reproduce:**

   1. Run the attached sample on an iOS 64 bit device in Debug mode (iPhone 5s, iPhone 6/6+)

**Actual Results:**

   The app will crash and an error message is logged in the Application Output

**Expected Results:**

   The app should show a UICollectionView. Run on a 32bit simulator or device to see the results. Or, modify the project to only include Armv7 and then run on the 64 bit device again. 

**Build Date & Platform:**

   iOS 8.3
   Unified / 64 bit device/simulator

**Additional Information:**

   The ViewController.cs logs some of the UICollectionView methods. 

Example 32 bit run:

> 2015-07-15 10:32:38.070 releaseBugDemo[10124:1476401] indexPath <NSIndexPath: 0x7db63af0> {length = 2, path = 0 - 8}
> 2015-07-15 10:32:38.070 releaseBugDemo[10124:1476401] collectionViewRect {X=0,Y=0,Width=221,Height=416}
> 2015-07-15 10:32:38.070 releaseBugDemo[10124:1476401] size {Width=105.5, Height=105.5}
> 2015-07-15 10:32:38.070 releaseBugDemo[10124:1476401] collectionView ContentSize {Width=501, Height=0}

Example 64 bit run:

> 2015-07-15 10:36:04.327 releaseBugDemo[49254:8938253] indexPath <NSIndexPath: 0xc000000000040016> {length = 2, path = 0 - 8}
> 2015-07-15 10:36:04.327 releaseBugDemo[49254:8938253] collectionViewRect {X=0,Y=0,Width=221,Height=416}
> 2015-07-15 10:36:04.327 releaseBugDemo[49254:8938253] size {Width=105.5, Height=105.5}
> 2015-07-15 10:36:04.327 releaseBugDemo[49254:8938253] collectionView ContentSize {Width=501, Height=0}
> 2015-07-15 10:36:04.328 releaseBugDemo[49254:8938253] the behavior of the UICollectionViewFlowLayout is not defined because:
> 2015-07-15 10:36:04.328 releaseBugDemo[49254:8938253] the item width must be less than the width of the UICollectionView minus the section insets left and right values.

The only difference in those logs other than the error message on 64 bit is the NSIndexPath value.
Comment 1 Udham Singh 2015-07-15 13:19:11 UTC
I have checked this issue with the help of test project attached in bug description and able to reproduce the reported behaviour. 

Please refer the screencast : http://www.screencast.com/t/tSNO1Eqhr

Application Output : https://gist.github.com/Arpit360/662384367a4186e61115
Build Output : https://gist.github.com/Arpit360/5fad7927efe4c3e827b4
Crash Log (Xcode): https://gist.github.com/Arpit360/2bf5ab45bfae98d6f272
iOS Device Log (Xcode): https://gist.github.com/Arpit360/2f975300ef55a7ee1038
Ide Log : https://gist.github.com/Arpit360/f042e0a16d067ce40c26
iOS Designer Log : https://gist.github.com/Arpit360/0b2811f24debfbb72f07

I have used iPhone 5S (iOS 8.3) to reproduce this issue.

Environment Info : 

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.4
Darwin mac360-xamarins-Mac-mini.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-07-16 06:54:44 UTC
This is wrong:

        public SizeF GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath)

you need to return a CoreGraphics.CGSize, not a SizeF (CGSize uses nfloat, while SizeF uses float).