Bug 2059 - adopting UITextInput protocol passes null or selectors are not called.
Summary: adopting UITextInput protocol passes null or selectors are not called.
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on: 265
  Show dependency tree
Reported: 2011-11-16 13:08 UTC by Eran Koren
Modified: 2011-11-30 10:17 UTC (History)
3 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 Eran Koren 2011-11-16 13:08:36 UTC
i'm adopting the UITextInput protocol as part of an implementation for an application that has a rich text editor for the iPad.
while starting to implement it and researching the monotouch sample:  
i saw that "firstRectForRange:" receives null for the "range" parameter.
this happens both in my code and the sample and is actually documented as something not working in the sample, similar objective-C code receives the actual parameter and works fine.
i tried checking if this was a problem only in the simulator(as sometime happens) and noticed there is even a bigger problem when running on the device the "inputDelegate" property is not assigned when running on the device (both iOS 4.3 & 5.0). again this happens both for my code and the monotouch sample. the objective-C sample works fine.

this is a blocking issue for me, please help.
Comment 1 Sebastien Pouliot 2011-11-16 15:17:21 UTC
note: the simulator related issues are already filled under bug #265
Comment 2 Eran Koren 2011-11-17 03:13:05 UTC
I don't think it is correct to assume the simulator bug is filled under bug #265. this was only a guess by the  writer of the sample and actually, the behavior and methods are different. there, we experience a crash for one function (with a different signature) and in this bug there are 2 methods one not called and the other gets a null parameter when the same objectice-c code receives a correct object.
Comment 3 Eran Koren 2011-11-24 03:44:44 UTC
don't know if this helps shed more light on the problem, but here goes:
since this is blocking to us and i couldn't wait for it to be fixed, i rewrote all my code for the view adopting the UITextInput protocol in objective-c put it in a  static lib and wrapped that in a mono dll with btouch.
the code is working fine. hope this helps solve the problem.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2011-11-25 19:47:06 UTC
The x86 abi issue has now been fixed (it turned out that my initial guess about why "firstRectForRange:" got a null value was correct).

The issue with inputDelegate on device has not been fixed yet, so leaving this bug open.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2011-11-30 09:03:55 UTC
I've found the bug, and a workaround for now is to override ConformsToProtocol:

public override bool ConformsToProtocol (IntPtr protocol)
    return base.ConformsToProtocol (protocol);
Comment 6 Rolf Bjarne Kvinge [MSFT] 2011-11-30 10:17:09 UTC
This bug has now been fixed, and the fix will be included in MonoTouch 5.0.4 and 5.1.1.