the intention of this this code here
https://github.com/xamarin/Xamarin.Forms/blob/bd31e1e9fc8b2f9ad94cc99e0c7ab058174821f3/Xamarin.Forms.Core/GridCalc.cs#L19
Needs to be propagated through the rest of the grid control
The issue here
https://github.com/xamarin/Xamarin.Forms/pull/6274
raised the probability of that type of situation arising.
The same treatment was already given to StackLayout but it should probably also be reconciled against the other layouts to see if there are similar scenarios where wayward invalidate measures can cause null exceptions
Related issue fixed for SL
https://github.com/xamarin/Xamarin.Forms/issues/4689
null reference exception when upgrading to xamarin forms 4 (android)
Don't crash
Crashes like a bomb :(
UNHANDLED EXCEPTION:
05-21 22:38:23.984 I/MonoDroid( 6859): System.NullReferenceException: Object reference not set to an instance of an object.
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00357] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:146
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0000c] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:485
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:60
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:762
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:644
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:702
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x00110] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:166
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:49
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1023
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:27
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1023
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:49
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-21 22:38:23.984 I/MonoDroid( 6859): at Xamarin.Forms.Layout+<>c.
05-21 22:38:23.984 I/MonoDroid( 6859): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <95d915721ad748108ff096dce8f8f32c>:0
05-21 22:38:23.984 I/MonoDroid( 6859): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <95d915721ad748108ff096dce8f8f32c>:0
05-21 22:38:23.984 I/MonoDroid( 6859): at (wrapper dynamic-method) System.Object.40(intptr,intptr)
05-21 22:38:24.012 E/Crash Report( 6859): Time: 5/21/2019 10:38:23 PM
05-21 22:38:24.012 E/Crash Report( 6859): Error: Unhandled Exception
05-21 22:38:24.012 E/Crash Report( 6859): System.Exception: Android_UnhandledExceptionRaiser ---> System.NullReferenceException: Object reference not set to an instance of an object.
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00357] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:146
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0000c] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:485
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:60
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:762
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:644
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:702
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x00110] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:166
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in D:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:49
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1023
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:686
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:27
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-21 22:38:24.012 E/Crash Report( 6859): at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1023
[5:GlobalExceptionManagerBase.LogUnhandledException] 1|2019-05-21 22:38:24.0168|FATAL|Time: 5/21/2019 10:38:23 PM
@InquisitorJax Can you please attach a small project that demonstrates this issue? Thanks!
Hi @samhouts ... bit snowed under with work, can't make any promises. Perhaps try adding a Grid to NavigationPage.TitleView with some content. That's the only "out of the ordinary" thing I see there.
Edit: Nope - that's not it - just commented out and still happens.
Bit of a challenge to pinpoint with such a generic stack trace - I have grids everywhere - and it's not a small app :P
I've found the offending grid - nested within a ContentView Grid... but's it's 1 a.m here - so I'm calling it a night. If whomever picks up this ticket needs to look at the code over skype - feel free to contact 'inquisitorjax'
I get a similar error after upgrading to version 4. Seems that it happens when I hide the grid.
When the grid is initally hidden I get the error when I try top unhide it. In that case it happens in the NumberOfUnsetColumnWidth() method. Here the trace for hiding the grid.
(At the end of this message I am adding the XAML).
System.NullReferenceException: Object reference not set to an instance of an object.
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Grid.MeasuredStarredColumns (System.Double widthConstraint, System.Double heightConstraint) [0x00163] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:436
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Grid.MeasureAndContractStarredColumns (System.Double width, System.Double height, System.Double totalStarsWidth) [0x00000] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:377
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0010e] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:511
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:60
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:762
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:644
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:702
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:163
05-22 09:52:40.573 I/MonoDroid(12283): 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) [0x00058] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:123
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.StackLayout.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0004e] in D:\a\1\s\Xamarin.Forms.Core\StackLayout.cs:58
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:784
05-22 09:52:40.573 I/MonoDroid(12283): at Xamarin.Forms.Layout+<>c.
05-22 09:52:40.573 I/MonoDroid(12283): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <44fafc2e0f1847ee827456a85a04372d>:0
05-22 09:52:40.573 I/MonoDroid(12283): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <44fafc2e0f1847ee827456a85a04372d>:0
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="PalabraMobile.BrowserPage">
<ContentPage.Resources>
<Style TargetType="Button">
<Setter Property="TextColor" Value="{Binding BarTextColor}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="BorderColor" Value="Transparent" />
<Setter Property="VerticalOptions" Value="Center" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="10,0,10,0" />
<Setter Property="BorderWidth" Value="0" />
<Setter Property="HeightRequest" Value="30" />
<Setter Property="WidthRequest" Value="30" />
</Style>
</ContentPage.Resources>
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="Default">0</On>
<On Platform="iOS">0,21,0,0</On>
</OnPlatform>
</ContentPage.Padding>
<ContentPage.Content>
<StackLayout Orientation="Vertical" Margin="0" Padding="0" Spacing="0" HorizontalOptions="FillAndExpand">
<Grid x:Name="toolBar" BackgroundColor="{Binding BarBackgroundColor}" Padding="0" Margin="0"
MinimumHeightRequest="50" HeightRequest="50" IsVisible="True">
<StackLayout Orientation="Horizontal" FlowDirection="LeftToRight" Padding="0" Margin="0"
HorizontalOptions="Start" VerticalOptions="CenterAndExpand" >
<Button x:Name="backBtn" FontAttributes="Bold" Image="angle_left.png" Command="{Binding GoHome}" Margin="7,0,10,0" />
<Button x:Name="settingsBtn" Image="settings.png" Command="{Binding GoSettings}" />
</StackLayout>
<StackLayout Orientation="Horizontal" FlowDirection="RightToLeft" Padding="0" Margin="0"
HorizontalOptions="End" VerticalOptions="CenterAndExpand" >
<Button x:Name="hideBarBtn" Image="angle_up.png" Command="{Binding ShowBar}" Margin="10,0,7,0" />
<Button x:Name="refreshBtn" Image="reload.png" Command="{Binding Refresh}" />
</StackLayout>
</Grid>
<Grid x:Name="browserView" BackgroundColor="White" Margin="0" Padding="0">
<WebView x:Name="browser" WidthRequest="1000" HeightRequest="1000" Margin="0"
VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Aqua"/>
<ActivityIndicator x:Name="activityIndicator" Grid.Row="0" Grid.Column="0"
VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" IsRunning="False" />
<Button x:Name="showBarBtn" Image="angle_down.png" Command="{Binding ShowBar}"
HorizontalOptions="End" VerticalOptions="Start" Margin="0,10,7,0" />
</Grid>
</StackLayout>
</ContentPage.Content>
</ContentPage>
@kwaclaw sounds about right. My landing page has a few grids / content views where the visibility is bound to ViewModel State.
@kwaclaw Same problem here. @InquisitorJax did you find any resolution?
@softsan not yet - unfortunately I have other priorities atm.
I can confirm the problem as well. Seems to be a race condition after setting/updating the bindingcontext, because it does not occour every time.
Version: XF 4.0.0.346134-pre9
Exception
```[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object.
[MonoDroid] at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00195] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:113
[MonoDroid] at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0000c] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:485
[MonoDroid] at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in D:\a\1\s\Xamarin.Forms.CoreGridCalc.cs:60
[MonoDroid] at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:762
[MonoDroid] at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:644
[MonoDroid] at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
[MonoDroid] at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:702
[MonoDroid] at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:41
[MonoDroid] at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:762
[MonoDroid] at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:644
[MonoDroid] at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:132
[MonoDroid] at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:702
[MonoDroid] at Xamarin.Forms.Platform.Android.ItemContentView.OnMeasure (System.Int32 widthMeasureSpec, System.Int32 heightMeasureSpec) [0x0003b] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ItemContentView.cs:55
[MonoDroid] at Android.Views.View.n_OnMeasure_II (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 widthMeasureSpec, System.Int32 heightMeasureSpec) [0x00009] in <44fafc2e0f1847ee827456a85a04372d>:0
[MonoDroid] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.31(intptr,intptr,int,int)
**Xaml**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="...">
<ContentView.Resources>
<ResourceDictionary Source="/Theming/CustomerDisplay.xaml" />
<Style TargetType="Label">
<Setter Property="FontFamily"
Value="{StaticResource MonoFontThin}" />
<Setter Property="TextColor"
Value="Black" />
<Setter Property="FontSize"
Value="Large" />
</Style>
</ContentView.Resources>
<Grid Margin="20,10,20,10"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<CollectionView ItemsSource="{Binding Path=Items}"
VerticalOptions="EndAndExpand"
HorizontalOptions="FillAndExpand"
SelectionMode="None"
Grid.ColumnSpan="2">
<CollectionView.ItemTemplate>
<!-- many content... -->
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="Total"
FontAttributes="Bold"
VerticalOptions="CenterAndExpand"
HorizontalOptions="FillAndExpand"
Grid.Row="1" />
<Label Text="{Binding Total}"
FontAttributes="Bold"
FontSize="42"
VerticalOptions="CenterAndExpand"
HorizontalOptions="EndAndExpand"
Grid.Row="1"
Grid.Column="1" />
</Grid>
</ContentView>
Code behind
```c#
namespace My.Name.Space
{
public partial class CustomerDisplayBookingView : ContentView
{
public CustomerDisplayBookingView(int width, int height, object bindingContext)
{
InitializeComponent();
WidthRequest = width;
HeightRequest = height;
BindingContext = bindingContext;
}
}
}
**Instanciation on looper thread**
```c#
var view = new CustomerDisplayBookingView(854, 480, bookingLayout);
Further information
I also tested ListView and BindableLayout - same problem.
I'm getting the same crash each time when navigating back from an oauth browser session.
When removing the grid, my AbsoluteLayout is misplacing it's children. This only happens with xamarin-auth backward navigation on android devices and could be connected to one or more plugins (Prism? Auth?).
Overall, the behavior is unexpected and this exception shouldn't be possible. People have already made reports about this issue back in 2017 and now it's occuring more frequently.
Special note
Since v4 with oauth, the GC is constantly logging informations about growing heaps (Nursery full). Not suprisingly, this incident appears right after the navigation, so there might be a leak somewhere.
When I look at the number of bugs posted in the last 48 hours it seems wise to revert back to version 3.6.
Can anyone having this issue test with the nuget attached here?
https://github.com/xamarin/Xamarin.Forms/issues/6260#issuecomment-495490890
let me know if it still happens
Another fix that might work is to roll back to legacy renderers
Forms.SetFlags("UseLegacyRenderers");
Perfect, It works.
@PureWeen
Another fix that might work is to roll back to legacy renderers
Forms.SetFlags("UseLegacyRenderers");
I stumbled upon this same issue when upgrading to 4 from 3.6, and going back to legacy renderers according to your suggestion solved my crashes!
In my case the problem was a not fully layouted forms view. There is a complex viewmodel with many bindings behind. Adding a delay solved my issue!
```c#
async static Task
{
var renderer = Platform.CreateRendererWithContext(view, context);
if (renderer == null)
return null;
renderer.Tracker.UpdateLayout();
var density = context.Resources.DisplayMetrics.Density;
var nativeDensityModifier = ignoreDensity ? 1 : density;
var formsDensityModifier = ignoreDensity ? density : 1;
var nativeSize = new Xamarin.Forms.Rectangle(0, 0, view.WidthRequest * nativeDensityModifier, view.HeightRequest * nativeDensityModifier);
var formsSize = new Xamarin.Forms.Rectangle(0, 0, view.WidthRequest / formsDensityModifier, view.HeightRequest / formsDensityModifier);
var viewGroup = renderer.View as ViewGroup;
viewGroup.LayoutParameters = new ViewGroup.LayoutParams((int)nativeSize.Width, (int)nativeSize.Height);
view.Layout(formsSize);
// Solves the problem!
await Task.Delay(TimeSpan.FromMilliseconds(600));
viewGroup.Layout(0, 0, (int)nativeSize.Width, (int)nativeSize.Height);
return viewGroup;
}
```
Using the Legacy Renderers work-around - my app launches without crashing - but unfortunately something is running in the background that freezes the app:
Looks like some sort of memory leak: (Works just fine when rolling back to 3.X Forms)
R_BRIDGE bridges 859 objects 859 opaque 0 colors 859 colors-bridged 859 colors-visible 859 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.06ms tarjan 0.12ms scc-setup 0.11ms gather-xref 0.02ms xref-setup 0.01ms cleanup 0.05ms
05-30 00:48:40.932 D/Mono ( 8997): GC_BRIDGE: Complete, was running for 10.34ms
05-30 00:48:40.932 D/Mono ( 8997): GC_MINOR: (Nursery full) time 2.39ms, stw 3.68ms promoted 94K major size: 3664K in use: 2874K los size: 2048K in use: 1411K
05-30 00:48:41.201 D/Mono ( 8997): DllImport searching in: '__Internal' ('(null)').
05-30 00:48:41.201 D/Mono ( 8997): Searching for 'java_interop_jnienv_call_float_method_a'.
05-30 00:48:41.201 D/Mono ( 8997): Probing 'java_interop_jnienv_call_float_method_a'.
05-30 00:48:41.201 D/Mono ( 8997): Found as 'java_interop_jnienv_call_float_method_a'.
05-30 00:48:41.213 I/Choreographer( 8997): Skipped 228 frames! The application may be doing too much work on its main thread.
05-30 00:48:41.291 I/OpenGLRenderer( 8997): Davey! duration=3883ms; Flags=0, IntendedVsync=141482019177109, Vsync=141485819176957, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=141485825662740, AnimationStart=141485825709320, PerformTraversalsStart=141485826095070, DrawStart=141485832601980, SyncQueued=141485835440340, SyncStart=141485835499050, IssueDrawCommandsStart=141485836426240, SwapBuffers=141485879979900, FrameCompleted=141485903055300, DequeueBufferDuration=838000, QueueBufferDuration=848000,
05-30 00:48:41.514 I/cilabs.remotim( 8997): Explicit concurrent copying GC freed 9146(491KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 453us total 9.765ms
05-30 00:48:41.516 D/Mono ( 8997): GC_TAR_BRIDGE bridges 858 objects 858 opaque 0 colors 858 colors-bridged 858 colors-visible 858 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.04ms tarjan 0.11ms scc-setup 0.09ms gather-xref 0.02ms xref-setup 0.01ms cleanup 0.28ms
05-30 00:48:41.516 D/Mono ( 8997): GC_BRIDGE: Complete, was running for 13.20ms
05-30 00:48:41.516 D/Mono ( 8997): GC_MINOR: (Nursery full) time 3.17ms, stw 3.93ms promoted 100K major size: 3776K in use: 2977K los size: 2048K in use: 1858K
05-30 00:48:42.074 I/cilabs.remotim( 8997): Explicit concurrent copying GC freed 9155(464KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2MB/4MB, paused 425us total 8.584ms
05-30 00:48:42.075 D/Mono ( 8997): GC_TAR_BRIDGE bridges 858 objects 858 opaque 0 colors 858 colors-bridged 858 colors-visible 858 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.04ms tarjan 0.11ms scc-setup 0.10ms gather-xref 0.02ms xref-setup 0.01ms cleanup 0.06ms
05-30 00:48:42.075 D/Mono ( 8997): GC_BRIDGE: Complete, was running for 10.80ms
I have this bug :(
Any fixes?
This bug seems to be random. Some users reports of single crashes, others - that crashes happens all times.
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Grid.GetLastAutoColumn (Xamarin.Forms.BindableObject child) <0x102e82744 + 0x00048> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Grid.ExpandLastAutoColumnIfNeeded (System.Double width, System.Boolean expandToRequest) <0x102e80b38 + 0x000db> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) <0x102e81b38 + 0x002cf> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102e7f240 + 0x0007b> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x102f0e4d0 + 0x00013> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102f0d868 + 0x000fb> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102e9d6fc + 0x00067> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x102f0db64 + 0x000d3> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.ScrollView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102ecb9b0 + 0x000b3> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x102f0e4d0 + 0x00013> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102f0d868 + 0x000fb> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x102e9d6fc + 0x00067> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x102f0db64 + 0x000d3> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x102e9d878 + 0x00217> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x102e7ef48 + 0x00293> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x102e9de78 + 0x003d3> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x102e9de50 + 0x0000f> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Xamarin.Forms.Layout.ResolveLayoutChanges () <0x102e9eaac + 0x0013b> in <8e9ab226c9a54dbdb9366a1fb41e66e3#c93ba9f9493f3ea18adeba50535fd5ca>:0
at Foundation.NSAsyncActionDispatcher.Apply () <0x1037cd1bc + 0x00023> in
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) <0x103787a70 + 0x0003f> in
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0x1037879c8 + 0x00053> in
at MyAppXamarinForms.iOS.Application.Main (System.String[] args) <0x1029164d8 + 0x00267> in <48dc354de05d4385bfcd50bcd44892a5#c93ba9f9493f3ea18adeba50535fd5ca>:0
We also got an AppCenter crash report with this issue for iPhone 6s (iOS 13.3). This issue is imho not related to a specific platform, but rather to Xamarin.Forms in general.
I now got the confirmation that this bug is definitely a cross platform issue, as it also happened on an iPhone XR running iOS 13.3.1.
The stacktrace: https://pastebin.com/hfaHXN2x
Same exception here. It only occurs on a page where the visibility of a grid is bound to a viewmodel property. I can not reproduce it, I only see a lot of appcenter traces for iPhones. Have not seen this on Android.
Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Grid.MeasuredStarredColumns (System.Double widthConstraint, System.Double heightConstraint) <0x102323e48 + 0x00330> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Grid.MeasureAndContractStarredColumns (System.Double width, System.Double height, System.Double totalStarsWidth) <0x102323908 + 0x0004f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) <0x1023242d4 + 0x00287> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1023219dc + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1023a62b4 + 0x00013> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1023a564c + 0x000fb> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10233a5fc + 0x00067> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1023a5948 + 0x000d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.FlexLayout+<>c__DisplayClass61_0.<AddChild>b__0 (Xamarin.Flex.Item it, System.Single& w, System.Single& h) <0x10231a6a4 + 0x0014b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Flex.Item.layout_item (Xamarin.Flex.Item item, System.Single width, System.Single height) <0x1022db730 + 0x0041f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Flex.Item.Layout () <0x1022db548 + 0x00053> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.FlexLayout.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1023190f8 + 0x00cf7> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1023a564c + 0x000fb> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10233a5fc + 0x00067> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1023a5948 + 0x000d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) <0x10238c428 + 0x003f3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
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) <0x10238c260 + 0x0011b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10238bfb8 + 0x00057> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1023a62b4 + 0x00013> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1023a564c + 0x000fb> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10233a5fc + 0x00067> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1023a5948 + 0x000d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.ScrollView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x102366ca8 + 0x002b3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x10239858c + 0x000db> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x1023216e4 + 0x00293> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.ContentPresenter.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x102304c50 + 0x000d7> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x1023216e4 + 0x00293> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x10239858c + 0x000db> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x10233ad78 + 0x003d3> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x10233ad50 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x1023553c4 + 0x001bf> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.UpdateChildrenLayout () <0x102355b20 + 0x0037f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.OnSizeAllocated (System.Double width, System.Double height) <0x102355b08 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Sepp.Mobile.Views.Base.PrismPageBase.OnSizeAllocated (System.Double width, System.Double height) <0x1015b3f94 + 0x000eb> in <d14bb11b8ea043119a88017e4d532530#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) <0x1023a7b60 + 0x0007b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) <0x1023a322c + 0x0009b> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) <0x10233a778 + 0x002ef> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x1023553c4 + 0x001bf> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.UpdateChildrenLayout () <0x102355b20 + 0x0037f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.OnSizeAllocated (System.Double width, System.Double height) <0x102355b08 + 0x0000f> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Page.set_ContainerArea (Xamarin.Forms.Rectangle value) <0x1023546b8 + 0x00087> in <3176ecd5cae2414a857d4580e79dcda0#f3ca2cf5ea24d885c43fd37312493362>:0
at Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidLayoutSubviews () <0x1024f80dc + 0x002db> in <52b46d19096449e8b2ba6f0a6feffc05#f3ca2cf5ea24d885c43fd37312493362>:0
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) <0x102056e9c + 0x0003f> in <79170d3ca0a34f20a27c5ea33d79161f#f3ca2cf5ea24d885c43fd37312493362>:0
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0x102056df4 + 0x00053> in <79170d3ca0a34f20a27c5ea33d79161f#f3ca2cf5ea24d885c43fd37312493362>:0
at Sepp.Mobile.iOS.Application.Main (System.String[] args) <0x10100e5e8 + 0x00033> in <43ea4d0585a046bfb1a11389be8b7aed#f3ca2cf5ea24d885c43fd37312493362>:0
Any updates on this one?
Update:
Checked the Grid
source code a bit, and see that _columns
and _rows
has been set to null in InvalidateMeasureInternal
, and in code itself - there is no protection against it. So wondering what is the reason for setting it to null in here, because if remove these lines - it shouldn't crash anymore for cases like IsVisible
. At least code Issue6247_Grid
doesn't crash anymore (but as far as it's some sort threading issue it still might occur in scenarios where _rows
or _columns
changes but with different exception).
internal override void InvalidateMeasureInternal(InvalidationTrigger trigger)
{
base.InvalidateMeasureInternal(trigger);
_columns = null;
_rows = null;
}
It can be reproduced with this code if you have few rows/columns defined
class Issue6247_Grid : Grid
{
protected override void LayoutChildren(double x, double y, double width, double height)
{
Task.Run(async () =>
{
await Task.Delay(1);
InvalidateMeasureInternal(InvalidationTrigger.Undefined);
});
base.LayoutChildren(x, y, width, height);
}
}
Hi
Any updates on this issue?
We have application that have number of grids using autocells, and development is on very advanced stage. This issue occurs from time to time and is quite a problem considering app size :-)
Any info about planned fix date/progress will be valuable, as we need to plan a strategy to solve this issue.
Thank you!
Most helpful comment
When I look at the number of bugs posted in the last 48 hours it seems wise to revert back to version 3.6.