I am having trouble setting up my application to allow for dragging and dropping of files from Finder (
sample app attached).
I receive the following error when accessing the DragDestination.PasteBoard.Types:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Cannot cast from source type to destination type.
at Cocoa.Pasteboard.ListForType (System.String type) [0x00000]
at devoc.MyView.ValidateDrag (Cocoa.DragDestination sender) [0x00000]
at devoc.MyView.DraggingEntered (Cocoa.DragDestination sender) [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] --- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000]
at Cocoa.ObjCInterop.Dispatch (IntPtr objc_class_ptr, IntPtr objc_selector, System.Object[] arguments) [0x00000]
at 45ff5f94-7d1a-4405-a90a-faba59dda100.Dispatch (IntPtr , IntPtr , IntPtr ) [0x00000]
at (wrapper native-to-managed) 45ff5f94-7d1a-4405-a90a-faba59dda100:Dispatch (intptr,intptr,intptr)
at (wrapper managed-to-native) System.Void_System.IntPtr_System.IntPtr:objc_msgSend (intptr,intptr)
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] --- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters) [0x00000]
at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args) [0x00000]
at Cocoa.ObjCMessaging.objc_msgSend (IntPtr receiver, System.String selector, System.Type rettype) [0x00000]
at Cocoa.Application.RunApplication () [0x00000]
at Cocoa.Application.Run () [0x00000]
at MyProgram.Program.Main (System.String[] args) [0x00000]