Bug 13738 - uicollectionview sample works in iOS Simulator but crashes on a physical device (iPhone 4S)
Summary: uicollectionview sample works in iOS Simulator but crashes on a physical devi...
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: 6.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-08-04 06:33 UTC by RichardH
Modified: 2013-12-05 18:36 UTC (History)
3 users (show)

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:

Description RichardH 2013-08-04 06:33:57 UTC
I'm no expert on the architecture of Xamarin.ios or Xamarin studio so forgive me is this is explained in simplistic terms.

A more detailed description of the conditions of this bug can be found in the following forum post - the exception information is also there:


I tried implementing a UICollectionView (inside a NavigationController), but had a few issues, so I went back and tried the tutorial on the xamarin site. I ran a cut down version of the tutorial code a few times on the iOS simulator and it worked as expected, but when I came to run it on the iPhone 4S it repeatedly crashed with the following exception:

System.InvalidCastException: Cannot cast from source type to destination type.

On one occasion it even caused the phone to spontaneously reboot.  I thought it must be my code, but when I ran it from Xamarin Studio with "Run > Start Without Debugging" it ran ok on the phone and didn't crash at all (tried launching it several times to make sure), which made me wonder if it's a problem with the debugger or something else.

I don't know which version number you want in the "version" box, so here is the full content of the About window:

=== Xamarin Studio ===

Version 4.0.10 (build 7)
Installation UUID: 886ad9db-dcd5-4d93-bb82-07c3ab70b3d3
	Mono 3.2.0 ((no/7c7fcc7)
	GTK 2.24.20
	GTK# (
	Package version: 302000000

=== Apple Developer Tools ===

Xcode 4.6.3 (2068)
Build 4H1503

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Not Installed

=== Xamarin.iOS ===

Version: (Indie Edition)
Hash: c9f7659
Build date: 2013-18-07 21:36:03-0400

=== Build Information ===

Release ID: 400100007
Git revision: f324e2154ee86ae1b6b8483392eddbf418e6381b
Build date: 2013-07-20 06:23:58+0000
Xamarin addins: fe4f180e2386eafc00087ef68c3a580cff4a2592

=== Operating System ===

Mac OS X 10.7.5
Darwin MacPro.local 11.4.2 Darwin Kernel Version 11.4.2
    Thu Aug 23 16:26:45 PDT 2012
    root:xnu-1699.32.7~1/RELEASE_I386 i386
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-08-05 06:57:56 UTC
Could you please attach your test project?
Comment 2 overgaardmorten 2013-08-17 09:25:58 UTC
See bug with ID 14047 for attached sample.

Exact same problem. This is very frustrating since even the samples provided by Xamarin does not work on a physical device.

Regards Morten
Comment 3 RichardH 2013-08-17 09:47:50 UTC
Rolf - sorry, seeing Morten's comment made me realize I'd forgotten to reply.

Unfortunately, the test project would be no use.  By the time I saw your original response, I'd changed it completely.  I didn't have it in a repository because it was just messing around with the example code from the xamarin website.

If it helps, after turning off the debugger, doing a couple of builds and then turning it on again, it seemed to fix the problem.
Comment 4 overgaardmorten 2013-08-17 09:57:06 UTC
just tried with out debugging and it seems to work.
Here are the steps

1) Started with a "Clean solution"
2) Switched to Release Mode
3) Run --> Start without debugging

And it works....

Regards Morten
Comment 5 PJ 2013-11-19 17:06:05 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 6 PJ 2013-12-05 18:36:34 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.