Bug 34535 - Cannot create an instance of AppKit.NSDraggingInfo because it is an abstract class
Summary: Cannot create an instance of AppKit.NSDraggingInfo because it is an abstract ...
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 2.4.0 (C6)
Hardware: Macintosh Mac OS
: High blocker
Target Milestone: master
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-10-02 14:51 UTC by Frank A. Krueger
Modified: 2015-10-15 10:34 UTC (History)
3 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:
VERIFIED FIXED

Description Frank A. Krueger 2015-10-02 14:51:30 UTC
Starting a dragging op always causes a crash because Xamarin has some internal code trying to create a class that, for some reason, is marked abstract.

This is a regression.

Repro:

1. New mac app
2. Create an NSOutline view
3. Enable that view for drag and drop using RegisterForDraggedTypes, PasteboardWriterForItem, ValidateDrop, and AcceptDrop
4. Populate the view with children
5. Try to drag an item

Result: Crash (below)
Expected: Drag operation begins


System.MemberAccessException: Cannot create an instance of AppKit.NSDraggingInfo because it is an abstract class
   at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in /Library/Frameworks/Xamarin.Mac.framework/Versions/2.4.0.62/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:line 632
   at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in /Library/Frameworks/Xamarin.Mac.framework/Versions/2.4.0.62/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:line 663
   at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) in /Library/Frameworks/Xamarin.Mac.framework/Versions/2.4.0.62/src/mono/mcs/class/corlib/System.Reflection/ConstructorInfo.cs:line 62
   at ObjCRuntime.Runtime.ConstructNSObject[T] (IntPtr ptr, System.Type type, MissingCtorResolution missingCtorResolution) in /Users/builder/data/lanes/2097/f85a8459/source/maccore/src/ObjCRuntime/Runtime.cs:line 790
   at ObjCRuntime.Runtime.GetNSObject (IntPtr ptr, System.Type target_type, MissingCtorResolution missingCtorResolution, Boolean evenInFinalizerQueue, System.Boolean& created) in /Users/builder/data/lanes/2097/f85a8459/source/maccore/src/ObjCRuntime/Runtime.cs:line 966
   at ObjCRuntime.Runtime.GetNSObjectWithType (IntPtr ptr, IntPtr type_ptr, System.Boolean& created) in /Users/builder/data/lanes/2097/f85a8459/source/maccore/src/ObjCRuntime/Runtime.cs:line 478
   at ObjCRuntime.Runtime.get_nsobject_with_type (IntPtr obj, IntPtr type, System.Boolean& created) in /Users/builder/data/lanes/2097/f85a8459/source/maccore/runtime/Delegates.generated.cs:line 208
   at (wrapper native-to-managed) ObjCRuntime.Runtime:get_nsobject_with_type (intptr,intptr,int&)
   at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
  
=== Xamarin Studio ===

Version 5.10 (build 800)
Installation UUID: fce13fdd-e8e3-48ef-99f1-4acbb06f0240
Runtime:
	Mono 4.2.1 (explicit/4a18c57)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010056

=== Xamarin.Profiler ===

Version: 0.0.0.0
Location: /Users/fak/Downloads/profiler-mac-0-2.9-29/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

=== Xamarin.Android ===

Version: 6.0.0.2 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)

SDK Tools Version: 24.1.2
SDK Platform Tools Version: 22
SDK Build Tools Version: 19.1

Java SDK: /usr
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b23)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b22, mixed mode)

=== Xamarin Android Player ===

Version: 0.3.7
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: 9.2.0.67 (Enterprise Edition)
Hash: f85a845
Branch: master
Build date: 2015-09-23 10:34:01-0400

=== Xamarin.Mac ===

Version: 2.4.0.62 (Enterprise Edition)

=== Build Information ===

Release ID: 510000800
Git revision: 92083188182e8c4588153e0d63e99c1a7037e4b6
Build date: 2015-09-18 15:03:06-04
Xamarin addins: 97a862a9dcaa31e9044c8613ef42e0a588c8d012
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.11.0
Darwin muon.local 15.0.0 Darwin Kernel Version 15.0.0
    Wed Aug 26 16:57:32 PDT 2015
    root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
Comment 1 Chris Hamons 2015-10-06 12:11:50 UTC
I am able to reproduce this with this sample:

mac-samples/NSOutlineViewAndTableView/NSOutlineViewAndTableViewExample

with this patch applied:

http://git.io/vcFdb
Comment 2 Chris Hamons 2015-10-06 12:27:56 UTC
Thanks for catching this! 

Fixed in master / d6a912f735aa45d545822782ba6e4468ff3b02da

I'm going to get this in the upcoming cycle so we don't completely break drag and drop. :)
Comment 3 Rajneesh Kumar 2015-10-07 15:15:19 UTC
@Chris,

To verify this issue I have tried to reproduce this issue but I am not sure about the steps to reproduce. So could you please share the steps to reproduce this issue. So I can verify this issue at our end efficiently.

Thanks..!
Comment 4 Chris Hamons 2015-10-07 15:20:57 UTC
@Rajneesh - 

1) Check out mac-samples/master
2) copy that patch to a file foo.patch
3) Apply it with patch -p1 < <full_path>/foo.patch
4) Build and launch NSOutlineViewAndTableView sample
5) Attempt to drag items on the outline view to other parts of the tree. It will crash w/o the fix.
Comment 5 Rajneesh Kumar 2015-10-08 10:51:15 UTC
@Chris, Thanks a lot for repo steps.

I have checked this issue with the Cycle 6 build
xamarin.mac-2.4.0.79_b5396c29ec2b327de2dd542c8d57fd7312368ba7 and I am able to reproduce it.
Screencast: http://www.screencast.com/t/JkjuN7XB

I also observed that this issue does't exist with the fix master build i.e
xamarin.mac-2.5.0.130_d6a912f735aa45d545822782ba6e4468ff3b02da

Now on attempt to drag items on the outline view to other parts of the tree. It does't crash with the fix build.

Screencast: http://www.screencast.com/t/TUWBKrxpxG0

This issue has been fixed in master build, I will close this issue after verifying it with release branch.

Thanks..!
Comment 6 Rajneesh Kumar 2015-10-15 10:34:45 UTC
I have checked this issue with the Cycle 6 build
xamarin.mac-2.4.0.88_1a6b88f2b2305d50bad065ae4c7292ab6348ff60 
I observed that this issue does't exist with this build. Now on attempt to drag items on the outline view to other parts of the tree, It does't crash. Please refer the screencast for the same.

Screencast: http://www.screencast.com/t/a0a4CR0GPXu

This issue has been fixed , hence I am closing this issue.

Thanks..!