Bug 33498 - UIKit.UIActionSheet..ctor (System.String title) causes System.ArgumentNullException
Summary: UIKit.UIActionSheet..ctor (System.String title) causes System.ArgumentNullExc...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.99 (iOS9 previews)
Hardware: PC Mac OS
: --- major
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-08-30 17:50 UTC by Frank A. Krueger
Modified: 2015-08-31 14:49 UTC (History)
2 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 Frank A. Krueger 2015-08-30 17:50:12 UTC
Repro Code:

var actionSheet = new UIActionSheet ("Hello World");

Expected: A new action sheet with no buttons
Result: Exception


For some reason that .ctor calls another .ctor with an array of one null title. That null title causes the error.

This code works fine on iOS 8 Xamarin, so must be a bug with new iOS 9 work.

ERROR: System.ArgumentNullException: Value cannot be null.
Parameter name: title
   at UIKit.UIActionSheet.AddButton (System.String title) in /Users/builder/data/lanes/1898/52034fbb/source/maccore/src/build/ios/native/UIKit/UIActionSheet.g.cs:line 139
   at UIKit.UIActionSheet..ctor (System.String title, IUIActionSheetDelegate del, System.String cancelTitle, System.String destroy, System.String[] other) in /Users/builder/data/lanes/1898/52034fbb/source/maccore/src/UIKit/UIActionSheet.cs:line 39
   at UIKit.UIActionSheet..ctor (System.String title, UIKit.UIActionSheetDelegate del, System.String cancelTitle, System.String destroy, System.String[] other) in /Users/builder/data/lanes/1898/52034fbb/source/maccore/src/UIKit/UIActionSheet.cs:line 21
   at UIKit.UIActionSheet..ctor (System.String title) in <filename unknown>:line 0
   at Praeclarum.UI.FormUI.ToActionSheet (Praeclarum.UI.Form form) in /Users/fak/Dropbox/Projects/Praeclarum/Praeclarum.iOS/UI/OldForm.cs:line 68
   at Praeclarum.UI.DocumentAppDelegate.ShowAddUI (UIKit.UIBarButtonItem addButton, Boolean dup, Boolean folder) in /Users/fak/Dropbox/Projects/Praeclarum/Praeclarum.iOS/UI/DocumentAppDelegate.cs:line 869
   at Praeclarum.UI.DocumentsViewController.HandleAdd (System.Object sender, System.EventArgs e) in /Users/fak/Dropbox/Projects/Praeclarum/Praeclarum.iOS/UI/DocumentsViewController.cs:line 897

=== Xamarin Studio ===

Version 5.9.5 (build 18)
Installation UUID: fce13fdd-e8e3-48ef-99f1-4acbb06f0240
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Apple Developer Tools ===

Xcode 7.0 (8208.9)
Build 7A192o

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 52034fb
Branch: master
Build date: 2015-08-26 23:50:57-0400

=== Xamarin.Android ===

Version: (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)
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: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 509050018
Git revision: e9148b1cfc781f8e7751f88540c6d65cca5be410
Build date: 2015-08-24 11:44:21-04
Xamarin addins: 3b908d565411f1a7425b67926ede4359e7000172

=== Operating System ===

Mac OS X 10.10.5
Darwin muon.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 Frank A. Krueger 2015-08-30 17:55:46 UTC
I was able to work around the bug by invoking the longer constructor myself:

var actionSheet = new UIActionSheet (form.Title,
				null, null, null, new string[0]);

So I've demoted this bug.
Comment 2 Miguel de Icaza [MSFT] 2015-08-31 14:49:45 UTC