Bug 5318 - No constructor found for MonoMac.Foundation.NSObject+MonoMac_Disposer::.ctor(System.IntPtr)
Summary: No constructor found for MonoMac.Foundation.NSObject+MonoMac_Disposer::.ctor(...
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
: 4803 ()
Depends on:
Reported: 2012-05-25 04:49 UTC by Marek Safar
Modified: 2012-08-14 12:25 UTC (History)
6 users (show)

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:

Description Marek Safar 2012-05-25 04:49:09 UTC
An unhandled exception has occured. Terminating MonoDevelop? True
System.MissingMethodException: No constructor found for MonoMac.Foundation.NSObject+MonoMac_Disposer::.ctor(System.IntPtr)
  at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00180] in /Users/marek/git/mono/mcs/class/corlib/System/Activator.cs:299 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in /Users/marek/git/mono/mcs/class/corlib/System/Activator.cs:234 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Users/marek/git/mono/mcs/class/corlib/System/Activator.cs:229 
  at MonoMac.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x0007a] in /Users/marek/git/monodevelop/main/external/monomac/src/ObjCRuntime/Runtime.cs:137 
  at MonoMac.ObjCRuntime.NSObjectMarshaler`1[MonoMac.Foundation.NSObject].MarshalNativeToManaged (IntPtr handle) [0x00001] in /Users/marek/git/monodevelop/main/external/monomac/src/ObjCRuntime/NSObjectMarshaler.cs:33 
  at (wrapper native-to-managed) object:[MonoMac.Foundation.NSObject:IntPtr NativeRetain()] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector)
  at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging:void_objc_msgSend_intptr_intptr_bool (intptr,intptr,intptr,intptr,bool)
  at MonoMac.Foundation.NSObject.Dispose (Boolean disposing) [0x000af] in /Users/marek/git/monodevelop/main/external/monomac/src/Foundation/NSObject.cs:138 
  at MonoMac.Foundation.NSObject.Finalize () [0x00001] in /Users/marek/git/monodevelop/main/external/monomac/src/Foundation/NSObject.cs:86
Comment 1 Bojan Rajkovic [MSFT] 2012-06-19 19:26:35 UTC
This happens when any MonoMac app shuts down. I can reproduce with MonoMac.dll shipped with MD from Wrench tip, md5 is MD5 (MonoMac.dll) = 70f421da0449f6df4f53ecc5ca328f19.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2012-06-20 06:12:36 UTC
I just got MD from here: https://wrench.internalx.com/Wrench/ViewLane.aspx?lane_id=84&host_id=1&revision_id=33792 , created a sample monomac app, but I couldn't reproduce it. Neither does it happen with MonoDevelop itself. Can you reproduce it by just creating a sample monomac app?
Comment 3 Bojan Rajkovic [MSFT] 2012-06-20 13:14:06 UTC
*** Bug 4803 has been marked as a duplicate of this bug. ***
Comment 4 Bojan Rajkovic [MSFT] 2012-06-20 13:22:56 UTC
I can't reproduce it by creating a sample MonoMac app, but I can reproduce it every time with mdtool, and with my short test program for dispatching Task<T> to Grand Central Dispatch, which can be found at https://raw.github.com/gist/2957032/b0c782ff0e18b2ddfcae210eb38c98cce0d44b9f/GCDTest.cs. I wonder if this has something to do with not calling NSApplication.Main (args), which mdtool cannot call and neither can my GCD tester app.
Comment 5 Martin Baulig 2012-08-13 13:49:31 UTC
This happens when when disposing the MonoMac_Disposer on exit.

This should fix it:
Comment 6 Miguel de Icaza [MSFT] 2012-08-14 12:25:16 UTC
Applied Martin's fix.