Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] NRE on Grid.CalculateAutoCells on iOS #10470

Closed
charlesroddie opened this issue Apr 27, 2020 · 5 comments · Fixed by #12646
Closed

[Bug] NRE on Grid.CalculateAutoCells on iOS #10470

charlesroddie opened this issue Apr 27, 2020 · 5 comments · Fixed by #12646
Assignees
Labels
blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/9 🕘 9 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! m/high impact ⬛ t/bug 🐛
Milestone

Comments

@charlesroddie
Copy link

Report from App Center. Issue affecting multiple users:

Application Specific Information:
*** Terminating app due to uncaught exception 'SIGABRT', reason: 'Object reference not set to an instance of an object'

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) <0x1045e2850 + 0x00494> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) <0x1045e5360 + 0x0004b> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1045e22b0 + 0x000fb> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>: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) <0x10467b8a0 + 0x001e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>: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) <0x10467b6a0 + 0x00187> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10467b310 + 0x000cb> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10468ee30 + 0x00137> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10468ee30 + 0x00137> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10468ee30 + 0x00137> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>: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) <0x10467b8a0 + 0x001e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>: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) <0x10467b6a0 + 0x00187> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x10467b310 + 0x000cb> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) <0x1046a2fa0 + 0x00037> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046a1d60 + 0x00253> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) <0x1046067d0 + 0x000e3> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) <0x1046a23a0 + 0x00233> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.ScrollView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) <0x104643ab0 + 0x0034f> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.UpdateChildrenLayout () <0x104607400 + 0x00573> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) <0x104607390 + 0x00023> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) <0x1046a3160 + 0x0002f> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Xamarin.Forms.Layout.ResolveLayoutChanges () <0x104608620 + 0x00187> in <46bb4f43387e4d3aa4c7b3d5909656ed#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at Foundation.NSAsyncActionDispatcher.Apply () <0x104ff1dd0 + 0x00023> in <d5ac8b1069644e148a96bf0a4b22f2fd#6bccd0eefe2c76428cf9204a0dbdb65a>: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) <0x104fa3d40 + 0x0002b> in <d5ac8b1069644e148a96bf0a4b22f2fd#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0x104fa3cb0 + 0x00043> in <d5ac8b1069644e148a96bf0a4b22f2fd#6bccd0eefe2c76428cf9204a0dbdb65a>:0
  at MathSpire.iOS.Application.Main (System.String[] args) <0x10413ac90 + 0x00023> in <c8c844a9682c4ed6b56696eb6357caff#6bccd0eefe2c76428cf9204a0dbdb65a>:0

We will see if we can reproduce on a local system and update this post. @kevcrooks

More info on this bug here:
https://forums.xamarin.com/discussion/88367/nullreferenceexception-on-grid-calculateautocells-only-xf-ios

Xamarin.Forms needs to enable C#8 nullable reference types to eliminate these NREs.

@charlesroddie charlesroddie added s/unverified New report that has yet to be verified t/bug 🐛 labels Apr 27, 2020
@hartez
Copy link
Contributor

hartez commented Apr 27, 2020

@charlesroddie Even if you can't get it to reproduce, if you could post your layout it might give us a clue what's happening and how we can create a repro here.

@PureWeen
Copy link
Contributor

Most likely a duplicate of

#6247

@hartez hartez removed the s/unverified New report that has yet to be verified label Apr 27, 2020
@hartez hartez added e/9 🕘 9 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often m/high impact ⬛ labels Apr 27, 2020
@charlesroddie
Copy link
Author

@hartez sorry still awaiting more diagnostics. We've identified the general area of the app from logs but need more detailed logs to pinpoint as we haven't reproduced on our own systems. But we get these crashes reported quite often.

@JMNewsome
Copy link

I am having this issue as well, I am experiencing this on Android (probably iOS as well), but I haven't located where this is occurring yet

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@charlesroddie
Copy link
Author

The right approach to fixing this and all the other NREs in Xamarin is to enable NRTs.

This is being done in the main-handler branch, for example #12135

Will this be merged into the Xamarin.Forms master branch or does this require MAUI? @PureWeen @hartez

@hartez hartez self-assigned this Oct 28, 2020
@hartez hartez added the in-progress This issue has an associated pull request that may resolve it! label Oct 28, 2020
@PureWeen PureWeen added the blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. label Nov 2, 2020
rmarinho pushed a commit that referenced this issue Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/9 🕘 9 i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! m/high impact ⬛ t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants