Bug 4393 - PresentViewController and DismissViewController should allow null completion handlers
Summary: PresentViewController and DismissViewController should allow null completion ...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2012-04-11 11:20 UTC by Adam Kemp
Modified: 2012-04-12 20:42 UTC (History)
2 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:
RESOLVED FIXED

Description Adam Kemp 2012-04-11 11:20:00 UTC
Most CocoaTouch APIs that take completion handler blocks allow nil, but MonoTouch's C# bindings throw an exception if you pass in null. In this case I have found that the UIViewController methods PresentViewController and DismissViewController don't allow null for completion handlers, but they should. There are probably related functions in the same class that have the same problem.
Comment 1 Sebastien Pouliot 2012-04-11 11:26:58 UTC
That's partially fixed. The upcoming 5.2.11 PresentViewController allows a null handler.

OTOH DismissViewController does not (yet) allow it. I'll test it and if ok (pretty sure it will be) ensure it gets fixed in future releases.
Comment 2 Sebastien Pouliot 2012-04-12 14:44:57 UTC
I reviewed the objective-c bindings using NSAction, all in UIKit except one in GameKit (for monotouch)

Along with UIViewController.DismissViewController both UIApplication.BeginBackgroundTask and SetKeepAliveTimeout will now allow null values (in 5.2.12+ and 5.3.3+).

master: 782ba7f459718bbd0d2c6c8d517290c1a1ae34b8
5.2-series: 08a9cd300c6ec1ae0f5be1692f216ea26db337fe

QA: unit tests added for all changes (on both branches)

p.s. keeping open since I'll also review maccore (that has our shared bindings with monomac).
Comment 3 Sebastien Pouliot 2012-04-12 20:42:08 UTC
Fixed a few more cases in maccore.

Let us know if you find other cases (not only NSAction can be null). Sometimes Apple docs are not clear if a NULL is allowed or not (we can test those). Other times the [NullAllowed] attribute is simply missing (or docs have been improved since the original bindings were done). Thanks!


master: df92e7d969c64def5e2a6c345b8a50e8d5358d00
5.2-series: 7b953bbb4cb27cb077ff8c0efe6b195d43802151

QA: unit tests added for all changes (on both branches)