Bug 553614

Summary: Cannot retrieve values from MKMapView SelectedAnnotations arra
Product: [Novell Products] MonoTouch Reporter: Forgotten User DPc9hjREQd <forgotten_DPc9hjREQd>
Component: RuntimeAssignee: Mono Bugs <mono-bugs>
Status: RESOLVED DUPLICATE QA Contact: Mono Bugs <mono-bugs>
Severity: Major    
Priority: P5 - None    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Test case for SelectedAnnotations issue

Description Forgotten User DPc9hjREQd 2009-11-07 19:01:06 UTC
Created attachment 326147 [details]
Test case for SelectedAnnotations issue

Description of Problem:

When attempting to retrieve the location (latitude, longitude, or CLLocationCoordinate2D), title, or subtitle of the selected annotation in MKMapView using the SelectedAnnotations property, the code will crash with a "Cannot cast from source type to destination type error" on both the simulator and device.


Steps to reproduce the problem:
1. Setup an MKMapView object in MonoDevelop and add annotations.
2. Add a callout button within MKAnnotationView-GetViewForAnnotation.
3. Attempt to retrieve the currently selected annotation's location using the following code:

CLLocationCoordinate2D locateme = mapView.SelectedAnnotations.First().Coordinate;


Actual Results:

The Application crashes with the following error report:

Stacktrace:


Native stacktrace:

	0   MapKit01                            0x00094caa mono_handle_native_sigsegv + 266
	1   MapKit01                            0x000071d1 mono_sigsegv_signal_handler + 289
	2   libSystem.B.dylib                   0x94b2ab9b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   CoreFoundation                      0x003e0869 __CFDictionaryDeallocate + 281
	5   CoreFoundation                      0x003bda41 _CFRelease + 241
	6   CoreFoundation                      0x003e0c12 __CFArrayReleaseValues + 434
	7   CoreFoundation                      0x003bda41 _CFRelease + 241
	8   CoreFoundation                      0x003e0869 __CFDictionaryDeallocate + 281
	9   CoreFoundation                      0x003bda41 _CFRelease + 241
	10  Foundation                          0x005a5cf5 NSPopAutoreleasePool + 341
	11  MapKit01                            0x002088cf main + 2527
	12  MapKit01                            0x00002be6 start + 54

Debug info from gdb:

touchdown
Main Cannot cast from source type to destination type.
warning: Trying to remove a section from the ordered section list that did not exist at 0x2e9000.
warning: Could not find object file "/var/folders/T+/T+AJnO+uH1mQ7y6ToV1aSU+++TI/-Tmp-/tmp4ce8a847.tmp/main.o" - no debug information available for "/var/folders/T+/T+AJnO+uH1mQ7y6ToV1aSU+++TI/-Tmp-/tmp4ce8a847.tmp/main.m".

Attaching to process 7063.
Reading symbols for shared libraries . done
Reading symbols for shared libraries .................................................................................... done
0x94acfaf9 in read$UNIX2003 ()
  8 port# 0x7607 0x94ae3756 in select$DARWIN_EXTSN ()
  7 port# 0x6f03 0x94ac47da in mach_msg_trap ()
  6 port# 0x4e03 0x94ac47da in mach_msg_trap ()
  5 port# 0x3a03 0x94ac47da in mach_msg_trap ()
  4 port# 0x3803 0x94ac4816 in semaphore_wait_trap ()
  3 port# 0x3403 0x94af2782 in __semwait_signal ()
  2 port# 0x2303 0x94ac47da in mach_msg_trap ()
* 1 port# 0x207  0x94acfaf9 in read$UNIX2003 ()

Thread 8 (process 7063):
#0  0x94ae3756 in select$DARWIN_EXTSN ()
#1  0x0043865e in __CFSocketManager ()
#2  0x94af1f39 in _pthread_start ()
#3  0x94af1dbe in thread_start ()

Thread 7 (process 7063):
#0  0x94ac47da in mach_msg_trap ()
#1  0x94ac4f47 in mach_msg ()
#2  0x003fe382 in CFRunLoopRunSpecific ()
#3  0x003fdc48 in CFRunLoopRunInMode ()
#4  0x03129b1e in GMM::TileCachePrivate::runCacheThread ()
#5  0x03129b31 in _runCacheThread ()
#6  0x94af1f39 in _pthread_start ()
#7  0x94af1dbe in thread_start ()

Thread 6 (process 7063):
#0  0x94ac47da in mach_msg_trap ()
#1  0x94ac4f47 in mach_msg ()
#2  0x003fe382 in CFRunLoopRunSpecific ()
#3  0x003fdc48 in CFRunLoopRunInMode ()
#4  0x005ff80e in +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] ()
#5  0x005a9f7d in -[NSThread main] ()
#6  0x005a9b18 in __NSThread__main__ ()
#7  0x94af1f39 in _pthread_start ()
#8  0x94af1dbe in thread_start ()

Thread 5 (process 7063):
#0  0x94ac47da in mach_msg_trap ()
#1  0x94ac4f47 in mach_msg ()
#2  0x003fe382 in CFRunLoopRunSpecific ()
#3  0x003fdc48 in CFRunLoopRunInMode ()
#4  0x03465803 in RunWebThread ()
#5  0x94af1f39 in _pthread_start ()
#6  0x94af1dbe in thread_start ()

Thread 4 (process 7063):
#0  0x94ac4816 in semaphore_wait_trap ()
#1  0x00110860 in finalizer_thread (unused=0x0) at ../../../../mono/metadata/gc.c:1022
#2  0x001a20d6 in start_wrapper (data=0x50169b0) at ../../../../mono/metadata/threads.c:662
#3  0x001d68a6 in thread_start_routine (args=0x5800c34) at ../../../../mono/io-layer/wthreads.c:286
#4  0x0020100c in GC_start_routine (arg=0x5142f60) at ../../../libgc/pthread_support.c:1390
#5  0x94af1f39 in _pthread_start ()
#6  0x94af1dbe in thread_start ()

Thread 3 (process 7063):
#0  0x94af2782 in __semwait_signal ()
#1  0x94b1e621 in nanosleep$UNIX2003 ()
#2  0x001b8ba0 in collection_thread (unused=0x0) at ../../../../mono/io-layer/collection.c:34
#3  0x94af1f39 in _pthread_start ()
#4  0x94af1dbe in thread_start ()

Thread 2 (process 7063):
#0  0x94ac47da in mach_msg_trap ()
#1  0x94ac4f47 in mach_msg ()
#2  0x000d7fda in mach_exception_thread (arg=0x0) at ../../../../mono/mini/mini-darwin.c:131
#3  0x0020100c in GC_start_routine (arg=0x5142f60) at ../../../libgc/pthread_support.c:1390
#4  0x94af1f39 in _pthread_start ()
#5  0x94af1dbe in thread_start ()

Thread 1 (process 7063):
#0  0x94acfaf9 in read$UNIX2003 ()
#1  0x00094dea in mono_handle_native_sigsegv (signal=11, ctx=0xbfffec04) at ../../../../mono/mini/mini-exceptions.c:1808
#2  0x000071d1 in mono_sigsegv_signal_handler (_dummy=11, info=0xbfffebc4, context=0xbfffec04) at ../../../../mono/mini/mini.c:4760
#3  <signal handler called>
#4  0x942ab92c in objc_msgSend ()
#5  0x05013790 in ?? ()
#6  0x003e0869 in __CFDictionaryDeallocate ()
#7  0x003bda41 in _CFRelease ()
#8  0x003e0c12 in __CFArrayReleaseValues ()
#9  0x003bda41 in _CFRelease ()
#10 0x003e0869 in __CFDictionaryDeallocate ()
#11 0x003bda41 in _CFRelease ()
#12 0x005a5cf5 in NSPopAutoreleasePool ()
#13 0x002088cf in main ()

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================


Expected Results:

SelectedAnnotations.Coordiante, SelectedAnnotations.Title, and SelectedAnnotations.Subtitle should return requested information per the documentation.


How often does this happen? 

This occurs any time the SelectedAnnotations property is called.


Additional Information:

A test case has been submitted with this bug report to reproduce the issue.  All code relating to the issue is contained in line 300 of Main.cs.
Comment 1 Geoff Norton 2009-11-25 02:47:06 UTC
The invalid cast has been fixed in 1.4, the rest of this is a dupe of 548346.

NOTE: MKMapView.SelectedAnnotations returns a NSObject now, as it could be a MKPlacemark or a MKAnnotation.

Thanks

*** This bug has been marked as a duplicate of bug 548346 ***