Bug 17377 - Argument cannot be null for many iOS properties/functions
Summary: Argument cannot be null for many iOS properties/functions
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.2.1
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-01-22 14:48 UTC by chris
Modified: 2014-03-20 14:48 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 chris 2014-01-22 14:48:01 UTC
I am often receiving an ArgumentNullException for cases where the Apple docs clearly allow null/nil values.

Could you do a review of the monotouch classes and remove those null checks?

I only remember the last two examples:

Unhandled managed exception: Argument cannot be null.
  Parameter name: value (System.ArgumentNullException)
    at MonoTouch.UIKit.UILocalNotification.set_SoundName (System.String value) [0x00059] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UILocalNotification.g.cs:377 

Apple doc:
soundName

The name of the file containing the sound to play when an alert is displayed. [...] The default value is nil (no sound).


If I remember correctly the same issue applies to MKAnnotationView leftCalloutAccessoryView, docs:

[...] The default value of this property is nil.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-01-24 04:49:51 UTC
Fixed UILocalNotification and MKAnnotationView.

monotouch/master: fc7ea5c50224a80ec4f916b54fd7cc5a9ffbd6bd and c62808abadcd3e58aa28025fcd258b4246a8a0a4

We're going through the API to find these cases, but it's a long process (note that we can't trust the documentation (every now and then we find out Apple's docs are wrong about something), so we have to right test cases for every single property).

If you find any other cases in the meantime, please just file a bug here with the name of the class and the selector, and we'll have a look.
Comment 2 Ram Chandra 2014-03-20 14:48:33 UTC
I have checked this issue on following builds:

Mac
Xamarin Studio : 4.2.4 (build 32)
Xamarin.iOS : 7.2.1.20 (Trial Edition)
Build Information
Release ID: 402040032
Git revision: a160c35dac9ab9fd32eeadaa171216316d5a5133
Build date: 2014-03-12 13:55:08-04
Xamarin addins: a779416ceabd54981ce812771a4061c942e8b872

I observed that now I am able to assign "null" value to the "set" accessor of  "SoundName" properties of "UILocalNotification" class and "LeftCalloutAccessoryView" property of "MKAnnotationView" class and I have not got ArgumentNullException. I have also observed the signature of  "SoundName" and "LeftCalloutAccessoryView" property is updated and removed extra null check from both the property in latest build i.e. x.iOS 7.2.1.20
 
screencast:  http://www.screencast.com/t/xsWvyiyx

This issue is working fine. Hence, I am closing this issue.