Bug 3265 - monotouch crash with MKMapView
Summary: monotouch crash with MKMapView
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-08 08:33 UTC by tkandiliotis
Modified: 2012-02-14 08:04 UTC (History)
2 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 NOT_REPRODUCIBLE

Description tkandiliotis 2012-02-08 08:33:57 UTC
I suspect that this is something that might be fixable only on your end. Not 100% sure though so please ignore if you think it's a problem with my code.

I have a MKMapView on my application and I got this monotouch exception recently. It's the only time me or anyone else has gotten this exception. It happened shortly after reactivating the app from the button apps menu of the iphone.

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[__NSCFArray mapView:didUpdateUserLocation:]: unrecognized selector sent to instance 0xc34190
 at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0 
 at PinMaster.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0

thanks
Comment 1 Sebastien Pouliot 2012-02-13 11:19:26 UTC
This looks like an (managed) instance of MKMapView got garbage collected. It's likely that your application does not keep a reference to some instance (of MKMapView) and that, later on, the native side tries to call it (the disposed instance).

A common pattern is using a local variable (that gets collected once it goes out of scope) and having events that use this local variable. The solution is to "promote" this local variable into a field, ensuring it will be "alive" as long as the type (and the associated events) are.

If this does not solve your problem then we'll need a test case (or access to your application code) to help you find the issue.
Comment 2 tkandiliotis 2012-02-13 21:10:04 UTC
Well its not one of those cases as the mkmapview is on the main view of the application and that view is designed with the interface builder.

I havent had this error again so its not a big deal. Initially i feared it was something that got broken with the new monotouch release. But.....false alarm

Keep up the good work
Comment 3 Sebastien Pouliot 2012-02-14 08:04:16 UTC
Thanks. Please re-opn the bug (with a test case) if you're able to duplicate this in the future.