xamarin/Xamarin.Forms

StackLayout Exception

Open

#8,919 opened on Dec 16, 2019

 (15 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
a/layouta/listviewhas-stacktracehelp wantedi/highinactives/unverifiedt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Exception when using stacklayout and/or listview. Reopening previously closed issue. I'm getting this exception even after upgrading Xamarin Forms.
Steps to Reproduce

Create a page with a stacklayout and/or a listview. Not sure which is the problem. I can't tell from the stack trace
Use the app as normal - intermittent issue in new XF

Expected Behavior

Things work without crashing Actual Behavior

Crashes sometimes with the following stack trace:

11-01 11:50:21.983 I/MonoDroid(18734): UNHANDLED EXCEPTION: 11-01 11:50:21.988 I/MonoDroid(18734): System.NullReferenceException: Object reference not set to an instance of an object. 11-01 11:50:21.988 I/MonoDroid(18734): at Xamarin.Forms.StackLayout.AlignOffAxis (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double widthConstraint, System.Double heightConstraint) [0x0004a] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:98 11-01 11:50:21.989 I/MonoDroid(18734): at Xamarin.Forms.StackLayout.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00034] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:53 11-01 11:50:21.989 I/MonoDroid(18734): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266 11-01 11:50:21.989 I/MonoDroid(18734): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224 11-01 11:50:21.989 I/MonoDroid(18734): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784 11-01 11:50:21.989 I/MonoDroid(18734): at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:392 11-01 11:50:21.989 I/MonoDroid(18734): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11a340ccc8de43f09c97400139266ef5>:0 11-01 11:50:21.989 I/MonoDroid(18734): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11a340ccc8de43f09c97400139266ef5>:0 11-01 11:50:21.989 I/MonoDroid(18734): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.33(intptr,intptr) 11-01 11:50:22.051 E/AppCenterCrashes(18734): Unhandled Exception from source=AndroidEnvironment 11-01 11:50:22.051 E/AppCenterCrashes(18734): System.NullReferenceException: Object reference not set to an instance of an object. 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.StackLayout.AlignOffAxis (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double widthConstraint, System.Double heightConstraint) [0x0004a] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:98 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.StackLayout.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00034] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:53 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:392 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11a340ccc8de43f09c97400139266ef5>:0 11-01 11:50:22.051 E/AppCenterCrashes(18734): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11a340ccc8de43f09c97400139266ef5>:0 11-01 11:50:22.051 E/AppCenterCrashes(18734): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.33(intptr,intptr) 11-01 11:50:22.278 D/Mono (18734): Loading reference 5 of /storage/emulated/0/Android/data/com.beincarib/files/.override/Microsoft.AppCenter.Crashes.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e 11-01 11:50:22.278 D/Mono (18734): Assembly Ref addref Microsoft.AppCenter.Crashes[0x6f6dfe1600] -> System.Core[0x6f5ffb1400]: 17 11-01 11:50:22.397 W/com.beincarib(18734): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable 11-01 11:50:22.398 D/Mono (18734): DllImport searching in: '__Internal' ('(null)'). 11-01 11:50:22.398 D/Mono (18734): Searching for 'java_interop_jnienv_throw'. 11-01 11:50:22.398 D/Mono (18734): Probing 'java_interop_jnienv_throw'. 11-01 11:50:22.398 D/Mono (18734): Found as 'java_interop_jnienv_throw'. Basic Information

Version with issue: Xamarin 16.3.0277
Last known good version: any version before
IDE: Visual Studio 16.4.1
Platform Target Frameworks:
    iOS: none
    Android: 10.1.1.0
    UWP: None
Android Support Library Version:
Nuget Packages:
Affected Devices:
Xamarin Forms 4.4.0

Screenshots Reproduction Link

I can't reproduce this except in my app as I don't know how to, I don't know what's causing it. I can't share my app publicly

Contributor guide