Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Simple to reproduce: NSMenu.Submenu simply does not allow a null value to be assigned, where the native NSMenu has no such restriction. It throws this:
System.ArgumentNullException: Argument cannot be null.
Parameter name: value
at at MonoMac.AppKit.NSMenuItem.set_Submenu (MonoMac.AppKit.NSMenu) <IL 0x00016, 0x00077>
I'm working around the problem like this:
MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(menuItem.Handle, MonoMac.ObjCRuntime.Selector.GetHandle("setSubmenu:"), IntPtr.Zero);
Which works as an interim fix, but it would be better if the wrapper was updated.
Xamarin Studio 4.2.1 (build 1)
Mac OS X 10.9
Sorry, I meant NSMenuItem.Submenu does not allow null values to be assigned (NSMenu has no submenu property).
Fixed on master / 714ee6b4dd94e029de6d09a83a79c56609b6e391
I have checked this issue with the following builds:
=== Xamarin Studio ===
Version 5.8 (build 1043)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Mono 4.0.0 ((detached/2634099)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000017
Apple Developer Tools Xcode 6.1 (6604)
Xamarin.Mac Version: 188.8.131.527 (Business Edition)
=== Build Information ===
Release ID: 508001043
Git revision: eeba4b77cc5ab021f9c5e2bddf16272e1f6b75d9
Build date: 2015-03-02 06:49:10-05
Xamarin addins: a58814e6e6034bf1169e758b92ead093a3f40404
Operating System Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
Sun Aug 17 19:50:11 PDT 2014
This issue is working fine now. I observed that property setter for NSMenuItem.Submenu allow null value to be assigned. Please refer the screencast :http://www.screencast.com/t/ayppp68hR
This issue has been fixed, hence I am closing this issue.