Bug 26379 - Overriding ShouldInvalidateOnChildAdded() in StackLayout subclass causes crash
Summary: Overriding ShouldInvalidateOnChildAdded() in StackLayout subclass causes crash
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-24 01:38 UTC by philip
Modified: 2015-05-18 19:48 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 philip 2015-01-24 01:38:19 UTC
When subclassing a StackLayout and adding this override, the app crashes:

	protected override bool ShouldInvalidateOnChildAdded(View child) { return false; }		

However, adding this does not cause a crash:

        protected override void OnChildMeasureInvalidated() { }

This appears to be an XF bug.  Only tested with Android app.  The stack trace is below:

01-24 06:32:59.040 I/MonoDroid( 9882): UNHANDLED EXCEPTION:
01-24 06:32:59.045 I/MonoDroid( 9882): Java.Lang.IllegalArgumentException: Exception of type 'Java.Lang.IllegalArgumentException' was thrown.
01-24 06:32:59.045 I/MonoDroid( 9882): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00047>
01-24 06:32:59.045 I/MonoDroid( 9882): at Android.Runtime.JNIEnv.CallStaticObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00064] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1161
01-24 06:32:59.045 I/MonoDroid( 9882): at Android.Graphics.Bitmap.CreateBitmap (int,int,Android.Graphics.Bitmap/Config) [0x0002d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-18/src/generated/Android.Graphics.Bitmap.cs:586
01-24 06:32:59.045 I/MonoDroid( 9882): at Xamarin.Forms.Platform.Android.FrameRenderer/FrameDrawable.CreateBitmap (bool,int,int) <IL 0x00009, 0x00053>
01-24 06:32:59.045 I/MonoDroid( 9882): at Xamarin.Forms.Platform.Android.FrameRenderer/FrameDrawable.Draw (Android.Graphics.Canvas) <IL 0x00041, 0x00137>
01-24 06:32:59.045 I/MonoDroid( 9882): at Android.Graphics.Drawables.Drawable.n_Draw_Landroid_graphics_Canvas_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-18/src/generated/Android.Graphics.Drawables.Drawable.cs:896
01-24 06:32:59.045 I/MonoDroid( 9882): at (wrapper dynamic-method) object.d433b1b1-39cc-4393-81b3-f87291c9655e (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
01-24 06:32:59.045 I/MonoDroid( 9882):   --- End of managed exception stack trace ---
01-24 06:32:59.045 I/MonoDroid( 9882): java.lang.IllegalArgumentException: width and height must be > 0
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:787)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:754)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at xamarin.forms.platform.android.FrameRenderer_FrameDrawable.n_draw(Native Method)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at xamarin.forms.platform.android.FrameRenderer_FrameDrawable.draw(FrameRenderer_FrameDrawable.java:49)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14450)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14350)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14468)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14350)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14468)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.widget.FrameLayout.draw(FrameLayout.java:472)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1609)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14350)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14468)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.widget.FrameLayout.draw(FrameLayout.java:472)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.widget.ScrollView.draw(ScrollView.java:1603)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14350)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14468)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14350)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14348)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.View.draw(View.java:14468)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.widget.FrameLayout.draw(FrameLayout.java:472)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2326)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2492)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:2405)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2249)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1879)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.Choreographer.doCallbacks(Choreographer.java:574)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.Choreographer.doFrame(Choreographer.java:544)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.os.Handler.handleCallback(Handler.java:733)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.os.Handler.dispatchMessage(Handler.java:95)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.os.Looper.loop(Looper.java:136)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at java.lang.reflect.Method.invoke(Method.java:515)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
01-24 06:32:59.045 I/MonoDroid( 9882): 	at dalvik.system.NativeStart.main(Native Method)
An unhandled exception occured.
Comment 1 Seth Rosetter 2015-05-18 19:48:35 UTC
Thank you for filing this. The crash should be resolved in our next release (1.4.3).