Bug 9770 - Generator produces incorrect connector for the RegisterAttribute
Summary: Generator produces incorrect connector for the RegisterAttribute
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.5.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2013-01-24 16:20 UTC by dean.ellis
Modified: 2014-09-23 23:42 UTC (History)
4 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 dean.ellis 2013-01-24 16:20:39 UTC
First found when investigating the issue with the ActionbarSherlock 

https://bugzilla.xamarin.com/show_bug.cgi?id=9446

The code generated for the isFloating java method was

   static IntPtr id_isFloating;
   public override global::System.Boolean IsFloating {
       [Register ("isFloating", "()Z", "GetGetIsFloatingHandler")]
        get {
	     if (id_isFloating == IntPtr.Zero)
		id_isFloating = JNIEnv.GetMethodID (class_ref, "isFloating", "()Z");
	      return global::Java.Lang.Object.GetObject<global::System.Boolean> (JNIEnv.CallBooleanMethod  (Handle, id_isFloating), JniHandleOwnership.TransferLocalRef);
	     }
   }

In this case the connector "GetGetIsFloatingHandler" does not exist in the generated code for Android.View.Window.
Comment 1 Atsushi Eno 2013-06-21 08:38:09 UTC
jonp: do we even use this Connector property nowadays? We have connector values in Mono.Android.dll in the same way as above and we don't have corresponding member either.
Comment 2 Jonathan Pryor 2013-06-21 14:40:11 UTC
> do we even use this Connector property nowadays?

Yes. The value is emitted into the Android Callable Wrappers as part of JNI native method hookup, in e.g. __md_methods:

http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/android_callable_wrappers

> we don't have corresponding member either.

I don't know what this means.

My _guess_ is that the bug is with binding projects, e.g. ActionBarSherlock is (presumably) overriding the Window.isFloating() method, and in _that_ circumstance our generated binding is referencing a GetGetIsFloatingHandler() connector, which is incorrect.
Comment 3 Atsushi Eno 2014-08-22 13:25:33 UTC
Fixed in master. [c33ffd0]

I thought GetGetIsFloatingHandler should exist in the base class (and took it as "missing"), which should actually be IsFloatingHandler.
Comment 4 narayanp 2014-09-23 09:11:18 UTC
I have explored Register Attribute and found following property 

public abstract bool IsFloating {
	[Register ("isFloating", "()Z", "GetIsFloatingHandler")]
	get;
}


But, I am not sure that How I have to verify this issue. Please provide me more directions to check this issue.

Environment Info :
Xamarin Studio Version 5.5 (build 203)
Git revision: 0d80212b712c0d42ecb20cf007b2192d715377a0
Xamarin addins: c31fea2f959659225466adef1c0793a8d7eebcef

Xamarin.Android
Version: 4.18.0.32
Comment 5 Atsushi Eno 2014-09-23 23:42:09 UTC
As long as you could find that RegisterAttribute having the right "connector" name (the third argument in the attribute constructor) it should be fine (that's how I checked the fix). Or to make sure, you could build an app that uses this value.