Bug 52624 - Crash with StackLayout inside Grid
Summary: Crash with StackLayout inside Grid
Status: RESOLVED DUPLICATE of bug 52533
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-20 00:18 UTC by Kent
Modified: 2017-02-21 20:09 UTC (History)
3 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 DUPLICATE of bug 52533

Description Kent 2017-02-20 00:18:15 UTC
This appears to have been previously fixed at #37741, but has regressed again with 2.3.4.

Here is the simplest repro I could find:

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>

        <StackLayout
            HorizontalOptions="End"
            Orientation="Horizontal">
            <Label Text="Crash"/>
        </StackLayout>
    </Grid>

This crashes with:

    {System.ArgumentException: NaN is not a valid value for width
      at Xamarin.Forms.Size..ctor (System.Double width, System.Double height) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Size.cs:19 
      at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:456 
      at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:527 
      at Xamarin.Forms.StackLayout.CompressHorizontalLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double widthConstraint, System.Double heightConstraint) [0x000f0] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:242 
      at Xamarin.Forms.StackLayout.CompressNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double widthConstraint, System.Double heightConstraint) [0x00020] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:275 
      at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00066] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:111 
      at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:67 
      at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:593 
      at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:469 
      at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:110 
      at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:527 
      at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:127 
      at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:48 
      at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x000c7] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:229 
      at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:194 
      at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629 
      at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:773 
      at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:157 
      at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:511 
      at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x0016b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:148 
      at Xamarin.Forms.Page.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00117] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Page.cs:180 
      at Xamarin.Forms.Page.UpdateChildrenLayout () [0x000d0] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Page.cs:252 
      at Xamarin.Forms.Page.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Page.cs:233 
      at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629 
      at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:773 
      at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:157 
      at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:511 
      at Xamarin.Forms.Platform.iOS.PageRenderer.SetElementSize (Xamarin.Forms.Size size) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:62 
      at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x000b0] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:333 
      at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x0003c] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:312 
      at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00010] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\PlatformRenderer.cs:148 
      at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
      at UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/build/ios/native/UIKit/UIWindow.g.cs:251 
      at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.SetMainPage () [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:159 
      at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00028] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:45 
      at LayoutCrashRepro.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x00013] in C:\Users\Kent\Documents\Visual Studio 2015\Projects\LayoutCrashRepro\LayoutCrashRepro\LayoutCrashRepro.iOS\AppDelegate.cs:28 
      at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
      at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
      at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
      at LayoutCrashRepro.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Kent\Documents\Visual Studio 2015\Projects\LayoutCrashRepro\LayoutCrashRepro\LayoutCrashRepro.iOS\Main.cs:17 }
Comment 1 Kent 2017-02-20 00:30:50 UTC
I'd like to suggest that this regression is of very high importance. It's certainly a blocker for us - we have too many screens affected by it for it to be practical working around it in every case.
Comment 2 Kent 2017-02-20 00:43:23 UTC
Also, I don't seem to be able to repro this on Android, only iOS.
Comment 3 Samantha Houts [MSFT] 2017-02-21 20:09:52 UTC

*** This bug has been marked as a duplicate of bug 52533 ***