Bug 24600 - Unified API NSTableViewDataSource Crashes on Assignment to NSTableview
Summary: Unified API NSTableViewDataSource Crashes on Assignment to NSTableview
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.11.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2014-11-18 03:55 UTC by David Lilley
Modified: 2014-12-01 08:56 UTC (History)
3 users (show)

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


Attachments
Self Contained Test (32.11 KB, application/zip)
2014-11-18 03:55 UTC, David Lilley
Details


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 FIXED

Description David Lilley 2014-11-18 03:55:17 UTC
Created attachment 8778 [details]
Self Contained Test

HI there

Using the Unified API I have found the NSTableViewDataSource crashes upon assignment to the NSTableview

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr (intptr,intptr,intptr) <IL 0x00011, 0xffffffff>
  at AppKit.NSTableView.set_WeakDataSource (Foundation.NSObject) [0x00060] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:2481
  at AppKit.NSTableView.set_DataSource (AppKit.NSTableViewDataSource) [0x00003] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:1798
  at TestTable.TableView..ctor (CoreGraphics.CGRect) [0x0001e] in /Users/davidlilley/Projects/TestTable/TestTable/TableView.cs:15
  at TestTable.MainWindow.AwakeFromNib () [0x0002c] in /Users/davidlilley/Projects/TestTable/TestTable/MainWindow.cs:22
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
  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/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSWindowController.g.cs:603
  at TestTable.MainWindowController.get_Window () [0x00002] in /Users/davidlilley/Projects/TestTable/TestTable/MainWindowController.cs:29
  at TestTable.AppDelegate.FinishedLaunching (Foundation.NSObject) [0x00012] in /Users/davidlilley/Projects/TestTable/TestTable/AppDelegate.cs:19
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 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/1248/0d8ffa22/source/xamcore/src/AppKit/NSApplication.cs:107
  at TestTable.MainClass.Main (string[]) [0x00007] in /Users/davidlilley/Projects/TestTable/TestTable/Main.cs:12
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-11-18 05:42:47 UTC
NSTableViewDataSource.GetObjectValue must return an object that implements CopyWithZone.

Using this instead fixes the crash:

	public override Foundation.NSObject GetObjectValue (NSTableView tableView, NSTableColumn tableColumn, nint row)
	{
		return new NSString ();
	}
Comment 2 David Lilley 2014-11-18 06:11:22 UTC
Ok good to know thanks Rolf but that is not the reason for the crash... it still fails for me.

But I still see the crash..

I see the debugger get to the constructor of the Datasource and return and then crash. Nothing in the datasource is hit by the debugger.

at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr (intptr,intptr,intptr) <IL 0x00011, 0xffffffff>
  at AppKit.NSTableView.set_WeakDataSource (Foundation.NSObject) [0x00060] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:2481
  at AppKit.NSTableView.set_DataSource (AppKit.NSTableViewDataSource) [0x00003] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:1798
  at TestTable.TableView..ctor (CoreGraphics.CGRect) [0x0001e] in /Users/davidlilley/Downloads/Archive/TestTable/TableView.cs:15
  at TestTable.MainWindow.AwakeFromNib () [0x0002c] in /Users/davidlilley/Downloads/Archive/TestTable/MainWindow.cs:22
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
  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/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSWindowController.g.cs:603
  at TestTable.MainWindowController.get_Window () [0x00002] in /Users/davidlilley/Downloads/Archive/TestTable/MainWindowController.cs:29
  at TestTable.AppDelegate.FinishedLaunching (Foundation.NSObject) [0x00012] in /Users/davidlilley/Downloads/Archive/TestTable/AppDelegate.cs:19
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 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/1248/0d8ffa22/source/xamcore/src/AppKit/NSApplication.cs:107
  at TestTable.MainClass.Main (string[]) [0x00007] in /Users/davidlilley/Downloads/Archive/TestTable/Main.cs:12
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-11-18 06:34:20 UTC
Can you attach the complete application output? You should get a native stack trace as well.
Comment 4 David Lilley 2014-11-18 08:13:40 UTC
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr (intptr,intptr,intptr) <IL 0x00011, 0xffffffff>
  at AppKit.NSTableView.set_WeakDataSource (Foundation.NSObject) [0x00060] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:2481
  at AppKit.NSTableView.set_DataSource (AppKit.NSTableViewDataSource) [0x00003] in /Users/builder/data/lanes/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSTableView.g.cs:1798
  at TestTable.TableView..ctor (CoreGraphics.CGRect) [0x0001e] in /Users/davidlilley/Downloads/Archive/TestTable/TableView.cs:15
  at TestTable.MainWindow.AwakeFromNib () [0x0002c] in /Users/davidlilley/Downloads/Archive/TestTable/MainWindow.cs:22
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
  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/1248/0d8ffa22/source/xamcore/src/build/mobile-64/AppKit/NSWindowController.g.cs:603
  at TestTable.MainWindowController.get_Window () [0x00002] in /Users/davidlilley/Downloads/Archive/TestTable/MainWindowController.cs:29
  at TestTable.AppDelegate.FinishedLaunching (Foundation.NSObject) [0x00012] in /Users/davidlilley/Downloads/Archive/TestTable/AppDelegate.cs:19
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 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/1248/0d8ffa22/source/xamcore/src/AppKit/NSApplication.cs:107
  at TestTable.MainClass.Main (string[]) [0x00007] in /Users/davidlilley/Downloads/Archive/TestTable/Main.cs:12
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:


Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.CIcuVq'
Executing commands in '/private/tmp/mono-gdb-commands.CIcuVq'.
(lldb) process attach --pid 2036
Process 2036 stopped
Executable module set to "/Users/davidlilley/Downloads/Archive/TestTable/bin/Debug/TestTable.app/Contents/MacOS/TestTable".
Architecture set to: x86_64-apple-macosx.
(lldb) thread list
Process 2036 stopped
* thread #1: tid = 0xdb1e5, 0x00007fff8a7c68fe libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0xdb207, 0x00007fff8a7c722e libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
  thread #3: tid = 0xdb20b, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #4: tid = 0xdb213, 0x00007fff8a7c156a libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #5: tid = 0xdb214, 0x00007fff8a7c6336 libsystem_kernel.dylib`__recvfrom + 10
  thread #6: tid = 0xdb262, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0xdb263, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #8: tid = 0xdb264, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #9: tid = 0xdb265, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1: tid = 0xdb1e5, 0x00007fff8a7c68fe libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff8a7c68fe libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x00000001000de7f1 TestTable`mono_handle_native_sigsegv(signal=<unavailable>, ctx=<unavailable>) + 433 at mini-exceptions.c:2323
    frame #2: 0x000000010005cea7 TestTable`mono_arch_handle_altstack_exception(sigctx=0x0000000101e63f48, fault_addr=<unavailable>, stack_ovf=0) + 87 at exceptions-amd64.c:902
    frame #3: 0x00000001000f79b6 TestTable`mono_sigsegv_signal_handler(_dummy=<unavailable>, info=<unavailable>, context=<unavailable>) + 374 at mini.c:6860
    frame #4: 0x00007fff85b2cf1a libsystem_platform.dylib`_sigtramp + 26
    frame #5: 0x00007fff866f80de libobjc.A.dylib`objc_msgSend + 30

  thread #2: tid = 0xdb207, 0x00007fff8a7c722e libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x00007fff8a7c722e libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x00007fff8a789d91 libdispatch.dylib`_dispatch_mgr_invoke + 247
    frame #2: 0x00007fff8a789a6a libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #3: tid = 0xdb20b, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8d78d757 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x00007fff8d78b4a1 libsystem_pthread.dylib`start_wqthread + 13

  thread #4: tid = 0xdb213, 0x00007fff8a7c156a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x00007fff8a7c156a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x000000010020f937 TestTable`mono_sem_wait(sem=0x00000001003537e8, alertable=1) + 23 at mono-semaphore.c:103
    frame #2: 0x0000000100142518 TestTable`finalizer_thread(unused=<unavailable>) + 88 at gc.c:1077
    frame #3: 0x00000001001d97fe TestTable`start_wrapper [inlined] start_wrapper_internal + 386 at threads.c:660
    frame #4: 0x00000001001d967c TestTable`start_wrapper(data=<unavailable>) + 44 at threads.c:707
    frame #5: 0x00000001002103ae TestTable`inner_start_thread(arg=<unavailable>) + 222 at mono-threads-posix.c:100
    frame #6: 0x0000000100233323 TestTable`GC_start_routine(arg=<unavailable>) + 83 at pthread_support.c:1502
    frame #7: 0x00007fff8d78d2fc libsystem_pthread.dylib`_pthread_body + 131
    frame #8: 0x00007fff8d78d279 libsystem_pthread.dylib`_pthread_start + 176
    frame #9: 0x00007fff8d78b4b1 libsystem_pthread.dylib`thread_start + 13

  thread #5: tid = 0xdb214, 0x00007fff8a7c6336 libsystem_kernel.dylib`__recvfrom + 10
    frame #0: 0x00007fff8a7c6336 libsystem_kernel.dylib`__recvfrom + 10
    frame #1: 0x000000010004d019 TestTable`socket_transport_recv(buf=0x0000000103403e05, len=11) + 121 at debugger-agent.c:1131
    frame #2: 0x000000010003dcf3 TestTable`debugger_thread [inlined] transport_recv(len=<unavailable>) + 33 at debugger-agent.c:1557
    frame #3: 0x000000010003dcd2 TestTable`debugger_thread(arg=<unavailable>) + 642 at debugger-agent.c:9551
    frame #4: 0x00000001002103ae TestTable`inner_start_thread(arg=<unavailable>) + 222 at mono-threads-posix.c:100
    frame #5: 0x0000000100233323 TestTable`GC_start_routine(arg=<unavailable>) + 83 at pthread_support.c:1502
    frame #6: 0x00007fff8d78d2fc libsystem_pthread.dylib`_pthread_body + 131
    frame #7: 0x00007fff8d78d279 libsystem_pthread.dylib`_pthread_start + 176
    frame #8: 0x00007fff8d78b4b1 libsystem_pthread.dylib`thread_start + 13

  thread #6: tid = 0xdb262, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8d78d757 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x00007fff8d78b4a1 libsystem_pthread.dylib`start_wqthread + 13

  thread #7: tid = 0xdb263, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8d78d757 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x00007fff8d78b4a1 libsystem_pthread.dylib`start_wqthread + 13

  thread #8: tid = 0xdb264, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8d78d757 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x00007fff8d78b4a1 libsystem_pthread.dylib`start_wqthread + 13

  thread #9: tid = 0xdb265, 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8a7c6946 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8d78d757 libsystem_pthread.dylib`_pthread_wqthread + 869
    frame #2: 0x00007fff8d78b4a1 libsystem_pthread.dylib`start_wqthread + 13
(lldb) detach

=================================================================
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.
=================================================================

Process 2036 detached
(lldb) quit
Comment 5 David Lilley 2014-11-18 08:14:19 UTC
=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: 974acce5-5296-4842-81d8-fad813eef863
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Xamarin.Android ===

Not Installed

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.38 (Business Edition)
Hash: 9e57461
Branch: 
Build date: 2014-11-10 21:18:38-0500

=== Xamarin.Mac ===

Version: 1.11.1.3 (Business Edition)

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.10.1
Darwin Davids-iMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 6 Rolf Bjarne Kvinge [MSFT] 2014-12-01 08:56:38 UTC
That crash is one we've already fixed in 1.11.1.201 (currently in the Alpha channel).