Bug 30024 - subclassing NSCollectionViewItem crash
Summary: subclassing NSCollectionViewItem crash
Status: CONFIRMED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) (show other bugs)
Version: 2.0.0
Hardware: Macintosh Mac OS
: Low normal
Target Milestone: master
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-05-13 06:05 UTC by Radu
Modified: 2016-09-26 21:58 UTC (History)
2 users (show)

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


Attachments
NSCollectionViewItem subclass crash (11.35 KB, application/zip)
2015-05-13 06:07 UTC, Radu
Details
Obj-c Version (36.37 KB, application/zip)
2015-07-01 11:27 UTC, Chris Hamons
Details

Description Radu 2015-05-13 06:05:23 UTC
Subclassing a NSCollectionViewItem and using that as prototype for a Collection View yields the crash below in application output on OS X versions prior to Yosemite. I have isolated the issue and attached a very simple repro. The crash happens on start.
Overriding the Identifier property of the NSCollectionViewItem subclass solves the issue.


Console Output:
2015-05-13 12:47:41.169 CollectionViewTest[6997:c07] -[MyColectionViewItem identifier]: unrecognized selector sent to instance 0x1079b7620
2015-05-13 12:47:41.183 CollectionViewTest[6997:c07] An uncaught exception was raised
2015-05-13 12:47:41.186 CollectionViewTest[6997:c07] -[MyColectionViewItem identifier]: unrecognized selector sent to instance 0x1079b7620
2015-05-13 12:47:41.200 CollectionViewTest[6997:c07] (
	0   CoreFoundation                      0x00007fff939c3b06 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff9437d3f0 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff93a5a40a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
	3   CoreFoundation                      0x00007fff939b2197 ___forwarding___ + 775
	4   CoreFoundation                      0x00007fff939b1e18 _CF_forwarding_prep_0 + 232
	5   AppKit                              0x00007fff8d17552e +[NSPersistentUIManager unarchiver:didDecodeObject:] + 107
	6   Foundation                          0x00007fff945b1a59 _decodeObjectBinary + 2965
	7   Foundation                          0x00007fff945b0d24 _decodeObject + 226
	8   AppKit                              0x00007fff8d1758ee -[NSNibConnector initWithCoder:] + 363
	9   AppKit                              0x00007fff8d175778 -[NSNibOutletConnector initWithCoder:] + 344
	10  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	11  Foundation                          0x00007fff945b2756 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189
	12  Foundation                          0x00007fff945b2cc8 -[NSArray(NSArray) initWithCoder:] + 538
	13  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	14  Foundation                          0x00007fff945b0d24 _decodeObject + 226
	15  AppKit                              0x00007fff8d1749ea -[NSIBObjectData initWithCoder:] + 2025
	16  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	17  Foundation                          0x00007fff945b0d24 _decodeObject + 226
	18  AppKit                              0x00007fff8d1740c3 loadNib + 227
	19  AppKit                              0x00007fff8d173649 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
	20  AppKit                              0x00007fff8d2c658c +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 140
	21  AppKit                              0x00007fff8d2f95db -[NSWindowController loadWindow] + 199
	22  AppKit                              0x00007fff8d2f92b5 -[NSWindowController window] + 77
	23  ???                                 0x000000010971bd29 0x0 + 4453416233
	24  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	25  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	26  CollectionViewTest                  0x0000000100008ab5 xamarin_invoke_trampoline + 4805
	27  CollectionViewTest                  0x0000000100009271 xamarin_arch_trampoline + 193
	28  CollectionViewTest                  0x000000010000a73a xamarin_x86_64_common_trampoline + 110
	29  CoreFoundation                      0x00007fff93975eda _CFXNotificationPost + 2554
	30  Foundation                          0x00007fff945ab7b6 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
	31  AppKit                              0x00007fff8d1db52d -[NSApplication _postDidFinishNotification] + 292
	32  AppKit                              0x00007fff8d1db266 -[NSApplication _sendFinishLaunchingNotification] + 216
	33  AppKit                              0x00007fff8d1d8452 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 566
	34  AppKit                              0x00007fff8d1d804c -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 351
	35  Foundation                          0x00007fff945c507b -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
	36  Foundation                          0x00007fff945c4edd _NSAppleEventManagerGenericHandler + 106
	37  AE                                  0x00007fff8cfcf078 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 307
	38  AE                                  0x00007fff8cfceed9 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 37
	39  AE                                  0x00007fff8cfced99 aeProcessAppleEvent + 318
	40  HIToolbox                           0x00007fff965a3709 AEProcessAppleEvent + 100
	41  AppKit                              0x00007fff8d1d4836 _DPSNextEvent + 1456
	42  AppKit                              0x00007fff8d1d3df2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
	43  AppKit                              0x00007fff8d1cb1a3 -[NSApplication run] + 517
	44  AppKit                              0x00007fff8d16fbd6 NSApplicationMain + 869
	45  ???                                 0x00000001069d6461 0x0 + 4405945441
	46  ???                                 0x00000001069d6155 0x0 + 4405944661
	47  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	48  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	49  CollectionViewTest                  0x00000001001a6788 mono_runtime_exec_main + 376
	50  CollectionViewTest                  0x000000010005ba77 mono_main + 7911
	51  CollectionViewTest                  0x000000010000ab00 main + 800
	52  CollectionViewTest                  0x0000000100001e34 start + 52
)
2015-05-13 12:47:41.202 CollectionViewTest[6997:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyColectionViewItem identifier]: unrecognized selector sent to instance 0x1079b7620'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff939c3b06 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff9437d3f0 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff93a5a40a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
	3   CoreFoundation                      0x00007fff939b2197 ___forwarding___ + 775
	4   CoreFoundation                      0x00007fff939b1e18 _CF_forwarding_prep_0 + 232
	5   AppKit                              0x00007fff8d17552e +[NSPersistentUIManager unarchiver:didDecodeObject:] + 107
	6   Foundation                          0x00007fff945b1a59 _decodeObjectBinary + 2965
	7   Foundation                          0x00007fff945b0d24 _decodeObject + 226
	8   AppKit                              0x00007fff8d1758ee -[NSNibConnector initWithCoder:] + 363
	9   AppKit                              0x00007fff8d175778 -[NSNibOutletConnector initWithCoder:] + 344
	10  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	11  Foundation                          0x00007fff945b2756 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189
	12  Foundation                          0x00007fff945b2cc8 -[NSArray(NSArray) initWithCoder:] + 538
	13  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	14  Foundation                          0x00007fff945b0d24 _decodeObject + 226
	15  AppKit                              0x00007fff8d1749ea -[NSIBObjectData initWithCoder:] + 2025
	16  Foundation                          0x00007fff945b1979 _decodeObjectBinary + 2741
	17  Foundation                          0x00007fff945b0d24 _decodeObject + 226
	18  AppKit                              0x00007fff8d1740c3 loadNib + 227
	19  AppKit                              0x00007fff8d173649 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
	20  AppKit                              0x00007fff8d2c658c +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 140
	21  AppKit                              0x00007fff8d2f95db -[NSWindowController loadWindow] + 199
	22  AppKit                              0x00007fff8d2f92b5 -[NSWindowController window] + 77
	23  ???                                 0x000000010971bd29 0x0 + 4453416233
	24  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	25  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	26  CollectionViewTest                  0x0000000100008ab5 xamarin_invoke_trampoline + 4805
	27  CollectionViewTest                  0x0000000100009271 xamarin_arch_trampoline + 193
	28  CollectionViewTest                  0x000000010000a73a xamarin_x86_64_common_trampoline + 110
	29  CoreFoundation                      0x00007fff93975eda _CFXNotificationPost + 2554
	30  Foundation                          0x00007fff945ab7b6 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
	31  AppKit                              0x00007fff8d1db52d -[NSApplication _postDidFinishNotification] + 292
	32  AppKit                              0x00007fff8d1db266 -[NSApplication _sendFinishLaunchingNotification] + 216
	33  AppKit                              0x00007fff8d1d8452 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 566
	34  AppKit                              0x00007fff8d1d804c -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 351
	35  Foundation                          0x00007fff945c507b -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
	36  Foundation                          0x00007fff945c4edd _NSAppleEventManagerGenericHandler + 106
	37  AE                                  0x00007fff8cfcf078 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 307
	38  AE                                  0x00007fff8cfceed9 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 37
	39  AE                                  0x00007fff8cfced99 aeProcessAppleEvent + 318
	40  HIToolbox                           0x00007fff965a3709 AEProcessAppleEvent + 100
	41  AppKit                              0x00007fff8d1d4836 _DPSNextEvent + 1456
	42  AppKit                              0x00007fff8d1d3df2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
	43  AppKit                              0x00007fff8d1cb1a3 -[NSApplication run] + 517
	44  AppKit                              0x00007fff8d16fbd6 NSApplicationMain + 869
	45  ???                                 0x00000001069d6461 0x0 + 4405945441
	46  ???                                 0x00000001069d6155 0x0 + 4405944661
	47  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	48  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	49  CollectionViewTest                  0x00000001001a6788 mono_runtime_exec_main + 376
	50  CollectionViewTest                  0x000000010005ba77 mono_main + 7911
	51  CollectionViewTest                  0x000000010000ab00 main + 800
	52  CollectionViewTest                  0x0000000100001e34 start + 52
)
libc++abi.dylib: terminate called throwing an exception
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr) <IL 0x00012, 0xffffffff>
  at AppKit.NSWindowController.get_Window () [0x0003a] in /Users/builder/data/lanes/1503/8a0e7bca/source/maccore/src/build/mac/mobile/AppKit/NSWindowController.g.cs:608
  at CollectionViewTest.MainWindowController.get_Window () [0x00002] in /Users/radu/Desktop/Dropbox/MyMacShared/Housatonic/Shells/XamarinApps/CollectionViewTest/MainWindowController.cs:29
  at CollectionViewTest.AppDelegate.DidFinishLaunching (Foundation.NSNotification) [0x00012] in /Users/radu/Desktop/Dropbox/MyMacShared/Housatonic/Shells/XamarinApps/CollectionViewTest/AppDelegate.cs:19
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00062, 0xffffffff>
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain (int,string[]) <IL 0x00093, 0xffffffff>
  at AppKit.NSApplication.Main (string[]) [0x00041] in /Users/builder/data/lanes/1503/8a0e7bca/source/maccore/src/AppKit/NSApplication.cs:94
  at CollectionViewTest.MainClass.Main (string[]) [0x00007] in /Users/radu/Desktop/Dropbox/MyMacShared/Housatonic/Shells/XamarinApps/CollectionViewTest/Main.cs:12
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00060, 0xffffffff>

Native stacktrace:

	0   CollectionViewTest                  0x00000001000ec8fa mono_handle_native_sigsegv + 282
	1   libsystem_c.dylib                   0x00007fff8ff9790a _sigtramp + 26
	2   ???                                 0x0000000000000000 0x0 + 0
	3   libsystem_c.dylib                   0x00007fff8ffeef61 abort + 143
	4   libc++abi.dylib                     0x00007fff971489eb abort_message + 257
	5   libc++abi.dylib                     0x00007fff9714639a _ZL17default_terminatev + 28
	6   libobjc.A.dylib                     0x00007fff9437d873 _ZL15_objc_terminatev + 91
	7   libc++abi.dylib                     0x00007fff971463c9 _ZL19safe_handler_callerPFvvE + 8
	8   libc++abi.dylib                     0x00007fff97146424 __cxa_bad_typeid + 0
	9   libc++abi.dylib                     0x00007fff9714758b _ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0
	10  libobjc.A.dylib                     0x00007fff9437d50c _ZL26_objc_exception_destructorPv + 0
	11  Foundation                          0x00007fff945b1b4e _decodeObjectBinary + 3210
	12  Foundation                          0x00007fff945b0d24 _decodeObject + 226
	13  AppKit                              0x00007fff8d1740c3 loadNib + 227
	14  AppKit                              0x00007fff8d173649 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
	15  AppKit                              0x00007fff8d2c658c +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 140
	16  AppKit                              0x00007fff8d2f95db -[NSWindowController loadWindow] + 199
	17  AppKit                              0x00007fff8d2f92b5 -[NSWindowController window] + 77
	18  ???                                 0x000000010971bd29 0x0 + 4453416233
	19  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	20  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	21  CollectionViewTest                  0x0000000100008ab5 xamarin_invoke_trampoline + 4805
	22  CollectionViewTest                  0x0000000100009271 xamarin_arch_trampoline + 193
	23  CollectionViewTest                  0x000000010000a73a xamarin_x86_64_common_trampoline + 110
	24  CoreFoundation                      0x00007fff93975eda _CFXNotificationPost + 2554
	25  Foundation                          0x00007fff945ab7b6 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
	26  AppKit                              0x00007fff8d1db52d -[NSApplication _postDidFinishNotification] + 292
	27  AppKit                              0x00007fff8d1db266 -[NSApplication _sendFinishLaunchingNotification] + 216
	28  AppKit                              0x00007fff8d1d8452 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 566
	29  AppKit                              0x00007fff8d1d804c -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 351
	30  Foundation                          0x00007fffWARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
945c507b -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
	31  Foundation                          0x00007fff945c4edd _NSAppleEventManagerGenericHandler + 106
	32  AE                                  0x00007fff8cfcf078 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 307
	33  AE                                  0x00007fff8cfceed9 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 37
	34  AE                                  0x00007fff8cfced99 aeProcessAppleEvent + 318
	35  HIToolbox                           0x00007fff965a3709 AEProcessAppleEvent + 100
	36  AppKit                              0x00007fff8d1d4836 _DPSNextEvent + 1456
	37  AppKit                              0x00007fff8d1d3df2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
	38  AppKit                              0x00007fff8d1cb1a3 -[NSApplication run] + 517
	39  AppKit                              0x00007fff8d16fbd6 NSApplicationMain + 869
	40  ???                                 0x00000001069d6461 0x0 + 4405945441
	41  ???                                 0x00000001069d6155 0x0 + 4405944661
	42  CollectionViewTest                  0x0000000100102919 mono_jit_runtime_invoke + 1673
	43  CollectionViewTest                  0x00000001001a0f7e mono_runtime_invoke + 110
	44  CollectionViewTest                  0x00000001001a6788 mono_runtime_exec_main + 376
	45  CollectionViewTest                  0x000000010005ba77 mono_main + 7911
	46  CollectionViewTest                  0x000000010000ab00 main + 800
	47  CollectionViewTest                  0x0000000100001e34 start + 52

Debug info from gdb:

^D
^D
^D
quit
quit
^D
quit
^D
quit
^D
quit
quit
^D
^D
^D
quit
(...)

About Xamarin Studio:
=== Xamarin Studio ===

Version 5.8.3 (build 1)
Installation UUID: 1c0da644-ba48-44a6-b3fc-c3f058a39852
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.Mac ===

Version: 2.0.0.262 (Indie Edition)

=== Xamarin.Android ===

Not Installed

=== Xamarin Android Player ===

Not Installed

=== Xamarin.iOS ===

Version: 8.10.0.267 (Indie Edition)
Hash: 6481535
Branch: master
Build date: 2015-04-27 04:38:13-0400

=== Build Information ===

Release ID: 508030001
Git revision: 6e8e725e0d689351901c2c70453bfa4ea25e293b
Build date: 2015-04-06 20:31:47-04
Xamarin addins: 051cd5f8c1b5dbfc87eaef80a74aec03f34c60a8

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64

This was reproduced on a Mountain Lion, but testers have reported this issue on Mavericks as well.
Comment 1 Radu 2015-05-13 06:07:37 UTC
Created attachment 11182 [details]
NSCollectionViewItem subclass crash
Comment 2 Chris Hamons 2015-07-01 11:27:26 UTC
Created attachment 11802 [details]
Obj-c Version
Comment 3 Chris Hamons 2015-07-01 11:28:19 UTC
That is strange. I created an obj-c version of that app, and I'm not seeing it request the Identifier on that OS version.

The work around is simple, at least.

Note You need to log in before you can comment on or make changes to this bug.