Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Customer is getting the following exception in their production code: (using Xamarin Forms 184.108.40.20647
System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ButtonDrawable from native handle 88800019
However it is not reproducible in the new projects.
I believe the issue is that the Xamarin.Forms.Platform.Android.ButtonDrawable class inherits from Java.Lang.Object but does not implement a constructor that accepts (IntPtr, JniHandleOwnership) arguments, as described in this StackOverflow thread: http://stackoverflow.com/questions/10593022/monodroid-error-when-calling-constructor-of-custom-view-twodscrollview/10603714#10603714 <http://stackoverflow.com/questions/10593022/monodroid-error-when-calling-constructor-of-custom-view-twodscrollview/10603714#10603714>.
This is the key concept from that thread:
The Android Callable Wrapper (ACW) <http://docs.xamarin.com/android/advanced_topics/architecture/android_callable_wrappers>'s constructor is invoked by Java and is responsible for creating the peer C# instance and mapping the Java instance to the C# instance <http://docs.xamarin.com/android/advanced_topics/garbage_collection#Cross-VM_Object_Collections>. However, if a virtual method is invoked from the Java constructor, then the method will be dispatched before there is a C# instance to invoke the method upon!
When this happens, the Mono runtime will attempt to invoke the (IntPtr, JniHandleOwnership) constructor on the C# class to establish the mapping with the corresponding Java class. The NotSupportedException indicates that the C# class is missing this constructor.
I'm getting this also when I inherit from ViewRenderer to create a custom renderer.
I have no chance to provide the missing constructor, since I can't access the constructor in the FormsViewGroup because the VisualElementRenderer default constructor hides it.
This is really a major issue to us.
It's been a month. No progress?
Now it's been almost 3 months. Still no progress?
I too would like this to be addressed.
I created a repro of a similar issue in another thread. Looks like many people are affected by this problem.
Please see: https://bugzilla.xamarin.com/show_bug.cgi?id=40692
Do you continue to experience this issue after updating Xamarin.Android?
Reports that this is still occurring on the latest Xamarin.Android:
=== Xamarin Studio Enterprise ===
Version 6.0.2 (build 73)
Installation UUID: c6cc2bf2-3d75-4e51-bb1f-b12a2a84f591
Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 404020011
=== Xamarin.Profiler ===
=== Apple Developer Tools ===
Xcode 7.3.1 (10188.1)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Visual Studio Enterprise)
Build date: 2016-07-28 12:17:02-0400
=== Xamarin.Android ===
Version: 18.104.22.168 (Visual Studio Enterprise)
Android SDK: /Users/mccorma/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.2
SDK Build Tools Version: 23.0.3
Java SDK: /usr
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Android Designer EPL code available here:
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 22.214.171.124 (Visual Studio Enterprise)
=== Xamarin Inspector ===
Build date: Mon Jun 13 19:14:13 UTC 2016
=== Build Information ===
Release ID: 600020073
Git revision: a6f7a24a9723a2d4f5d33c176615b0d44703ab5b
Build date: 2016-07-26 13:36:15-04
Xamarin addins: f5acb37866a0141bc5ddbe95118f18dae4014568
Build lane: monodevelop-lion-cycle7-sr1
I'm not able to reproduce this issue as described. If this is still occuring, please reopen the issue and include a project that demonstrates this issue with explicit steps to observe the behavior.