Bug 10268

Summary: Linker issue with horizontallistview project in release mode
Product: Android Reporter: Abdelkader <abdelkader.benabdi>
Component: Mono runtime / AOT CompilerAssignee: Bugzilla <bugzilla>
Severity: normal CC: benjamin, bjarne, chrisntr, guillaume.moissaing, jonp, manwatermelon, mono-bugs+monodroid, peter.collins, radek.doulik, Rajneeshk
Priority: Normal    
Version: 4.8.x   
Target Milestone: 5.1   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description Abdelkader 2013-02-13 05:47:33 UTC
Trying to execute this sample https://github.com/Cheesebaron/Cheesebaron.HorizontalListView , I'm getting an issue with linker, when it's none it works, but when setting to sdk assemblies only i'm getting an exception:

UNHANDLED EXCEPTION: System.ArgumentException: Couldn't bind to method 'GetGetAdapterHandler'.
at System.Delegate.GetCandidateMethod (System.Type,System.Type,string,System.Reflection.BindingFlags,bool,bool) <0x00290>
at System.Delegate.CreateDelegate (System.Type,System.Type,string,bool,bool) <0x00053>
at System.Delegate.CreateDelegate (System.Type,System.Type,string) <0x00033>
at Android.Runtime.JNIEnv.RegisterJniNatives (intptr,int,intptr,intptr,int) <0x006df>
at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_intptr_JValue[] (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x000ab>
at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) <0x00053>
at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup) <0x0018f>
at RedFabriQ.mCatalog.Player.Droid.HomeActivity/VerticalAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <0x0004f>
at Android.Widget.ArrayAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) <0x00087>
at (wrapper dynamic-method) object.ffe11527-2e87-4e53-8958-d56cfaf29cc7 (intptr,intptr,int,intptr,intptr) <0x0005b>

Any help.
Comment 2 Jonathan Pryor 2013-02-26 10:53:43 UTC
The workaround is to provide a custom link script:


Creating a new file (e.g. `FixAdapterLinking.xml`), set its Build action to LinkDescription, with the contents:

  <?xml version="1.0" encoding="UTF-8" ?>
    <assembly fullname="Mono.Android">
      <type fullname="Android.Widget.AdapterView" >
        <method name="GetGetAdapterHandler" />
        <method name="GetSetAdapter_Landroid_widget_Adapter_Handler" />
Comment 3 Radek Doulik 2014-11-23 05:50:43 UTC
it is now fixed in master 216f75038afee2105182fc6af329f1fc83c4298f
Comment 4 Bjarne Fisker 2015-01-23 07:34:08 UTC
This bug might need to be reopened. I just encountered the exact same bug in the current version of Xamarin 5.7(build 667) .

The workaround above fixed the problem for me.
Comment 5 Manwatermelon 2015-03-10 10:30:45 UTC
This bug reproduces on Xamarin 5.7.2 (build 7)
Comment 6 Jonathan Pryor 2015-03-10 11:45:19 UTC
Xamarin 5.7.2 is Xamarin.Android 4.20. The bug fix is in Xamarin.Android 5.0.

You could try the Xamarin.Android 5.0 preview:

Comment 7 Rajneesh Kumar 2015-05-05 11:24:47 UTC
I have checked this issue with the following builds:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin   3.11.507.0 (dfac85e)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android (cbdf025e886eacb95ce7adf53346961156fae990)
Visual Studio plugin to enable development for Xamarin.Android.

I observed that this issue working fine. Now, user does't get exception when setting to sdk assemblies only.
Here is the screencast for the same: http://www.screencast.com/t/zrTUPa78qy

This issue has been fixed hence I am closing this issue.