Bug 60507 - System.NotSupportedException : Unable to activate instance of type Xamarin.Forms.Platform.Android.LabelRenderer from native handle 0xbffe071c (key_handle 0x8615874).
Summary: System.NotSupportedException : Unable to activate instance of type Xamarin.Fo...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 60525 ()
Depends on:
Blocks:
 
Reported: 2017-11-03 05:28 UTC by Sreenesh S Pai
Modified: 2018-01-02 23:05 UTC (History)
5 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 NOT_REPRODUCIBLE

Description Sreenesh S Pai 2017-11-03 05:28:08 UTC
I have a content page with many controls including Labels. After I do something on the page and when I click on back button at Navigation Bar of the page the app crashes on Android with following Exception : 

System.NotSupportedException : Unable to activate instance of type Xamarin.Forms.Platform.Android.LabelRenderer from native handle 0xbffe071c (key_handle 0x8615874).

Stacktrace :

  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Java.Lang.Object.GetObject[T] (System.IntPtr jnienv, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00006] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00000] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at (wrapper dynamic-method) System.Object:7c4e0348-b7b8-44bc-8cbd-84ce901c15ca (intptr,intptr,intptr)

Inner Exception : System.MethodMissingException

Message : No constructor found for Xamarin.Forms.Platform.Android.LabelRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)


Inner Exception Stacktrace :   at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <2cbc8bc37f564147a10de1abb0c4e399>:0 
  at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <2cbc8bc37f564147a10de1abb0c4e399>:0 



Inner Exception inside Inner Exception : System.Exception : Exception of type 'Java.Interop.JavaLocationException' was thrown.


Stacktrace : Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
  --- End of managed Java.Lang.Error stack trace ---
java.lang.Error: Java callstack:
	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_dispatchTouchEvent(Native Method)
	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.dispatchTouchEvent(VisualElementRenderer_1.java:64)
	at android.view.ViewGroup.cancelTouchTarget(ViewGroup.java:2450)
	at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4782)
	at android.view.ViewGroup.removeAllViews(ViewGroup.java:4735)
	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onDestroyView(Native Method)
	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onDestroyView(FragmentContainer.java:59)
	at android.support.v4.app.Fragment.performDestroyView(Fragment.java:2410)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1378)
	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1598)
	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2145)
	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1998)
	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:709)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5417)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Comment 1 Sreenesh S Pai 2017-11-03 05:30:47 UTC
I am using Xamarin Forms 2.4.0.38779 version.
Comment 2 Paul DiPietro [MSFT] 2017-11-03 05:35:19 UTC
Can you please provide us with a reproduction?
Comment 3 Sreenesh S Pai 2017-11-03 06:16:04 UTC
The page which created this exception is few levels inside from my huge application. The test case scenario is like this page has lot of data with entire page content in scrollview. The issue is produced when I scroll to top with gestures and qucikly tap back button while the page is scrolling. Due to the complexities I am not able to provide a sample.
Comment 4 Paul DiPietro [MSFT] 2017-11-06 15:32:01 UTC
*** Bug 60525 has been marked as a duplicate of this bug. ***
Comment 5 Antoine Boulinguez 2017-11-06 15:36:43 UTC
Any news? I'm facing a similar problem and it's impossible to publish a new version of our app with this kind of crash inside...
Comment 6 Paul DiPietro [MSFT] 2017-11-06 15:39:40 UTC
We need a reproduction with more information.
Comment 7 Antoine Boulinguez 2017-11-06 15:44:26 UTC
Like @SreeneshSPai, this problem occured in a complex app that can't be easily shared. 

The context in my case:

-Xamarin Forms PCL/Android project
-Master details page with a navigation page inside
-I navigate to a ContentPage
-I kill the app on my Android device (Nexus 5)
-The app crashes with the following exception:

MonoDroid(12709): UNHANDLED EXCEPTION:
MonoDroid(12709): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.LabelRenderer from native handle 0xbeab6b1c (key_handle 0x12a7b64). ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.LabelRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
Comment 8 cunnpole 2017-11-08 11:19:32 UTC
I'm guessing it's related to the recent comments on this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=39451
Comment 9 Sreenesh S Pai 2017-11-10 05:19:38 UTC
Did you find any work arounds?
Comment 10 Paul DiPietro [MSFT] 2017-12-13 16:24:29 UTC
As we haven't received a reproduction per our request, we will be closing this for now. Please reopen this issue here (or open a new issue on GitHub at https://github.com/xamarin/Xamarin.Forms/issues) with a minimized reproduction we can use to investigate, if this issue still occurs as of the latest 2.5.0 stable release of Forms. Thanks!
Comment 11 Cliff Cawley 2018-01-02 23:02:23 UTC
Just thought I'd add that we're getting this in our production app too. Still trying to narrow down what exactly is causing it. Unlike other bugs we don't have a listview within a listview.

It's a listview with a header and within the header are a bunch of controls.

This started in XF 2.4 and still exists in 2.5

If I can figure out the reproduction case I'll open an issue on github and link here
Comment 12 Cliff Cawley 2018-01-02 23:05:18 UTC
Oh forgot to mention, this only happens on some devices. In particular Samsung Galaxy S6 and SONY XPERIA. Doesn't reproduce on nexus 5x or Galaxy note 2