Bug 32462 - Crash after a page disappeared if a ScrollView is in the HeaderTemplate property of a ListView
Summary: Crash after a page disappeared if a ScrollView is in the HeaderTemplate prope...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.4
Hardware: PC Windows
: Normal critical
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
URL:
: 33911 36285 ()
Depends on:
Blocks:
 
Reported: 2015-07-27 05:28 UTC by 胡玮文
Modified: 2018-04-11 15:22 UTC (History)
19 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
the reproduction (44.07 KB, application/octet-stream)
2015-07-28 22:42 UTC, 胡玮文
Details


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:
VERIFIED FIXED

Description 胡玮文 2015-07-27 05:28:11 UTC
I put a ScrollView in the HeaderTemplate property of a ListWiew to show some pictures.
But if I Slide the ListView to make the header out of view and touch back button to return to the previous page,app will crash after the animation.
I get System.NotSupportedException and the following output

07-27 17:03:43.048 I/MonoDroid( 3516): UNHANDLED EXCEPTION:
07-27 17:03:43.048 I/MonoDroid( 3516): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ScrollViewRenderer from native handle bf8f373c ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.ScrollViewRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
07-27 17:03:43.048 I/MonoDroid( 3516): Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
07-27 17:03:43.049 I/MonoDroid( 3516):   --- End of managed exception stack trace ---
07-27 17:03:43.049 I/MonoDroid( 3516): java.lang.Error: Java callstack:
07-27 17:03:43.049 I/MonoDroid( 3516): 	at md5530bd51e982e6e7b340b73e88efe666e.ScrollViewRenderer.n_onDetachedFromWindow(Native Method)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at md5530bd51e982e6e7b340b73e88efe666e.ScrollViewRenderer.onDetachedFromWindow(ScrollViewRenderer.java:89)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.View.dispatchDetachedFromWindow(View.java:13560)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2837)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4398)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.ViewGroup.removeAllViews(ViewGroup.java:4344)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at md5530bd51e982e6e7b340b73e88efe666e.GenericAnimatorListener.n_onAnimationEnd(Native Method)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at md5530bd51e982e6e7b340b73e88efe666e.GenericAnimatorListener.onAnimationEnd(GenericAnimatorListener.java:46)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1116)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1171)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:722)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:738)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.Choreographer.doCallbacks(Choreographer.java:580)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.Choreographer.doFrame(Choreographer.java:549)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.os.Handler.handleCallback(Handler.java:739)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.os.Handler.dispatchMessage(Handler.java:95)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.os.Looper.loop(Looper.java:135)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at android.app.ActivityThread.main(ActivityThread.java:5254)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at java.lang.reflect.Method.invoke(Native Method)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at java.lang.reflect.Method.invoke(Method.java:372)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
07-27 17:03:43.049 I/MonoDroid( 3516): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
07-27 17:03:43.049 I/MonoDroid( 3516):   --- End of inner exception stack trace ---
07-27 17:03:43.049 I/MonoDroid( 3516):   at Java.Interop.TypeManager.CreateProxy (System.Type type, IntPtr handle, JniHandleOwnership transfer) [0x00039] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:267 
07-27 17:03:43.049 I/MonoDroid( 3516):   at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x001ea] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:249 
07-27 17:03:43.049 I/MonoDroid( 3516):   --- End of inner exception stack trace ---
07-27 17:03:43.049 I/MonoDroid( 3516): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
07-27 17:03:43.049 I/MonoDroid( 3516): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr) [0x00083] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1010
07-27 17:03:43.049 I/MonoDroid( 3516): at Android.Views.ViewGroup.RemoveAllViews () [0x00058] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:4483
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Dispose (bool) <0x001ac>
07-27 17:03:43.049 I/MonoDroid( 3516): at Java.Lang.Object.Dispose () [0x00000] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:124
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Dispose (bool) <0x0016f>
07-27 17:03:43.049 I/MonoDroid( 3516): at Java.Lang.Object.Dispose () [0x00000] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:124
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.ListViewRenderer.Dispose (bool) <IL 0x0001d, 0x00077>
07-27 17:03:43.049 I/MonoDroid( 3516): at Java.Lang.Object.Dispose () [0x00000] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:124
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.Page>.Dispose (bool) <0x0016f>
07-27 17:03:43.049 I/MonoDroid( 3516): at Java.Lang.Object.Dispose () [0x00000] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:124
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.NavigationRenderer/<>c__DisplayClass8.<SwitchContentAsync>b__3 (Android.Animation.Animator) <IL 0x00087, 0x00199>
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.NavigationRenderer/<>c__DisplayClassa.<SwitchContentAsync>b__4 (Android.Animation.Animator) <IL 0x0000d, 0x0003f>
07-27 17:03:43.049 I/MonoDroid( 3516): at Xamarin.Forms.Platform.Android.GenericAnimatorListener.OnAnimationEnd (Android.Animation.Animator) <IL 0x0000f, 0x00062>
07-27 17:03:43.049 I/MonoDroid( 3516): at Android.Animation.AnimatorListenerAdapter.n_OnAnimationEnd_Landroid_animation_Animator_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Animation.AnimatorListenerAdapter.cs:105
07-27 17:03:43.049 I/MonoDroid( 3516): at (wrapper dynamic-method) object.d9e90d23-3946-4259-9cb1-071b397912be (intptr,intptr,intptr) <IL 0x00017, 0x00027>
07-27 17:03:43.050 D/AndroidRuntime( 3516): Shutting down VM
Comment 1 Chris King 2015-07-28 13:28:47 UTC
Thanks for taking the time to submit this bug. Could you please attach the reproduction that you created? That will greatly expedite the resolution of this issue and ensure we fix the same issue you are seeing.

Warm regards,
XFT
Comment 2 胡玮文 2015-07-28 22:42:49 UTC
Created attachment 12259 [details]
the reproduction

Click the button ,slide the ListView,and touch back button.the exception will occured
Comment 3 3803657 2015-08-14 03:29:40 UTC
Same problem here
Comment 4 alex 2015-08-19 13:03:15 UTC
We have same problem
Comment 5 alex 2015-08-19 13:28:51 UTC
Adding .ctor to custom view/control solved that crash in our case.

protected CustomImageView(IntPtr javaReference, JniHandleOwnership transfer)
           : base(javaReference, transfer) { }
Comment 6 3803657 2015-08-19 21:32:32 UTC
That works, but it's just a workaround, the code still need to be fixed
Comment 7 Chris King 2015-09-03 13:53:14 UTC
Repro attached
Comment 8 Paul DiPietro [MSFT] 2015-09-06 21:49:31 UTC
Was there supposed to be another reproduction? I only see the one from 2015/07/28.
Comment 9 Sebastian Brandes 2015-11-02 12:27:27 UTC
I have reproduced the bug here: https://youtu.be/tkCFa8FCbKI

Here is the full output of my debug window: http://pastebin.com/SNfkHz0r
Comment 10 Ahmed Alejo 2015-11-25 14:05:49 UTC
So this is confirmed and being confirmed, and continue to be confirmed....

When is it going to be resolved or a workaround provided.
Comment 11 Ahmed Alejo 2015-11-28 12:59:50 UTC
[WORKAROUND|SOLUTION] i won´t explain a lot i didn´t get much either, but i will share what helped me

Add the following renderer:

using System;
using Android.Runtime;
using Xamarin.Forms;

[assembly: ExportRenderer(typeof(Xamarin.Forms.ScrollView), typeof(ScrollViewRenderer))]
/// <summary>
/// This renderer was added to resolve a bug that crashed the application in known case
/// Bug 36285 - Android App (Always) Crashes After Navigating Away From Page With A ScrollView In HeaderTemplate of ListView
/// <seealso cref="https://bugzilla.xamarin.com/show_bug.cgi?id=36285"/>
/// and 
/// Bug 32462 - Crash after a page disappeared if a ScrollView is in the HeaderTemplate property of a ListView
/// <seealso cref="https://bugzilla.xamarin.com/show_bug.cgi?id=32462"/>
/// </summary>
public class ScrollViewRenderer : Xamarin.Forms.Platform.Android.ScrollViewRenderer
{
    public ScrollViewRenderer()
    { }

    public ScrollViewRenderer(IntPtr javaReference, JniHandleOwnership transfer)
    { }
}


i wonder why this constructor isn´t added by default.
Comment 12 Ahmed Alejo 2015-11-28 13:03:59 UTC
This issue also exist in 
    - Xamarin.Forms 1.5.1
    - Xamarin.Forms 2.0

And are solved by this SIMPLE fix.  why hasn´t this been done Xamarin.
Like we say here in Brazil "Assim você me quebra as pernas" - "This way you break my legs(cripple me)"
Comment 13 Balakrishnan 2016-02-18 12:06:13 UTC
We have the same problem and managed by the workaround.
Comment 14 adrianknight89 2016-02-29 03:57:12 UTC
I have the same problem for another class: Xamarin.Forms.Platform.Android.Platform+DefaultRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership). This was reported in July of last year yet it HASN'T been fixed :( Very sad.
Comment 15 Samantha Houts [MSFT] 2016-03-18 01:46:04 UTC
Should be fixed in 2.2.0-pre1
Comment 16 Ahmed Alejo 2016-03-18 11:43:40 UTC
"..Should"? wasn´t it tested ..., UITest-TestCloud?

We don´t report bugs as "there´s probably a bug in 2.2.0-pre1 please fix" you would always ask for a repro, more details(, all the hardwork).

more details please.
Comment 17 Jason Smith [MSFT] 2016-03-18 11:49:24 UTC
it was tested, but there is always the chance the next release might be a hotfix only or the fix could be kicked out to the next version, hence "Should".
Comment 18 Ahmed Alejo 2016-03-18 15:37:07 UTC
Reasonable, it´s that "Should" sounds to "me" as the infamous "we don´t know what happen, but now it works"

I just thought it´d be fair to get a better response on the, as we need to give
a better report of the bug (mostly with code samples, reproduction steps)


thanks for the reply.
Comment 19 Samantha Houts [MSFT] 2016-03-18 17:54:35 UTC
*** Bug 36285 has been marked as a duplicate of this bug. ***
Comment 20 Samantha Houts [MSFT] 2016-03-21 21:31:05 UTC
*** Bug 39451 has been marked as a duplicate of this bug. ***
Comment 21 Samantha Houts [MSFT] 2016-03-21 21:36:45 UTC
*** Bug 33911 has been marked as a duplicate of this bug. ***
Comment 22 Parmendra Kumar 2016-04-07 16:23:39 UTC
I have checked this issue with Xamarin.Forms 2.2.0-pre1 and its working fine.

Hence closing this issue.
Comment 23 philip 2016-04-26 17:16:06 UTC
This has regressed with today's alpha bits:

04-26 13:11:17.473 I/MonoDroid(26499): System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.Platform+DefaultRenderer from native handle 0xbeaff59c (key_handle 0xc5956b5). ---> System.MissingMethodException: No constructor found for Xamarin.Forms.Platform.Android.Platform+DefaultRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
04-26 13:11:17.473 I/MonoDroid(26499): Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
04-26 13:11:17.473 I/MonoDroid(26499):   --- End of managed exception stack trace ---
04-26 13:11:17.473 I/MonoDroid(26499): java.lang.Error: Java callstack:
04-26 13:11:17.473 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
04-26 13:11:17.473 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
04-26 13:11:17.473 I/MonoDroid(26499): 	at android.view.View.layout(View.java:15694)
04-26 13:11:17.473 I/MonoDroid(26499): 	at android.view.ViewGroup.layout(ViewGroup.java:5039)
04-26 13:11:17.474 I/MonoDroid(26499): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
04-26 13:11:17.474 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
04-26 13:11:17.474 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
04-26 13:11:17.474 I/MonoDroid(26499): 	at android.view.View.layout(View.java:15694)
04-26 13:11:17.474 I/MonoDroid(26499): 	at android.view.ViewGroup.layout(ViewGroup.java:5039)
04-26 13:11:17.474 I/MonoDroid(26499): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
04-26 13:11:17.474 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
04-26 13:11:17.474 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
04-26 13:11:17.474 I/MonoDroid(26499): 	at android.view.View.layout(View.java:15694)
04-26 13:11:17.474 I/MonoDroid(26499): 	at android.view.ViewGroup.layout(ViewGroup.java:5039)
04-26 13:11:17.475 I/MonoDroid(26499): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
04-26 13:11:17.475 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
04-26 13:11:17.475 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
04-26 13:11:17.475 I/MonoDroid(26499): 	at android.view.View.layout(View.java:15694)
04-26 13:11:17.475 I/MonoDroid(26499): 	at android.view.ViewGroup.layout(ViewGroup.java:5039)
04-26 13:11:17.475 I/MonoDroid(26499): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
04-26 13:11:17.475 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
04-26 13:11:17.475 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
04-26 13:11:17.475 I/MonoDroid(26499): 	at android.view.View.layout(View.java:15694)
04-26 13:11:17.475 I/MonoDroid(26499): 	at android.view.ViewGroup.layout(ViewGroup.java:5039)
04-26 13:11:17.475 I/MonoDroid(26499): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
04-26 13:11:17.475 I/MonoDroid(26499): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2.n_onLayout(Native Method)
Comment 25 Mikalai Daronin 2018-04-04 13:28:38 UTC
This is not fixed, I see this crash with Xamarin.Forms 2.5.0.280555.
Comment 26 sviluppo.software 2018-04-11 15:22:16 UTC
This is not fixed also for me, I have the same crash with Xamarin.Forms 2.5.0.122203.