Bug 3819 - UIView.ConvertRectFromView optional nil parameter not supported
Summary: UIView.ConvertRectFromView optional nil parameter not supported
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2012-03-09 03:40 UTC by info
Modified: 2012-03-09 09:47 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 info 2012-03-09 03:40:13 UTC
According to the official Apple documentation of UIView convertRect:fromWindow:

"Parameters
[...]
view
    The view with rect in its coordinate system. If view is *nil*, this method instead converts from window base coordinates. Otherwise, both view and the receiver must belong to the same UIWindow object."

However, if I pass null for the fromView parameter in MonoTouch I get an immediate ArgumentNullException. This makes it impossible to covert from window base coordinates.

The same bug definitely exists in UIWindow.ConvertRectFromView and probably also in all other [UIWindow|UIView].Convert[Point|Rect][To|From][Window|View] methods. 

In any of these methods the second parameter may be legally nil. Therefore MonoTouch should allow passing null for this parameter and not throw an ArgumentNullException.
Comment 1 Sebastien Pouliot 2012-03-09 09:30:18 UTC
Some of them already allows `null` while other throws an exception. I'll review/fix them.
Thanks for the report.
Comment 2 Sebastien Pouliot 2012-03-09 09:47:51 UTC
ConvertPoint* were already correct.
ConvertRect* were missing a [NullAllowed] attribute.

Fixed in master a7577f9f67726d514e8e330ac71dc601b210c40b
Fixed in 5.2-series 6bd36e6657f3ffc4dae3735d6a6339e6be185718

QA: unit tests added