How to Debug System.NullReferenceException

boberbober Member
edited February 28 in Xamarin.iOS

In our Xamarin Forms Project (currently only iOS) happen som wired Exceptions:

  • the App Crashes in Project.iOS.Application.Main.cs Line 17
  • the Exception Caught Window says System.NullReferenceException
  • Stacktrace is Empty [External Code]
  • in Properties StackTrace Property hold the Stacktrace (only Xamarin.Forms.Core Sources)
  • Different TargetSite Properties e.g.: System.Reflection.MonoMethod: {Xamarin.Forms.RowDefinition GetLastAutoRow(Xamarin.Forms.BindableObject)}

How i can debug this kinds of issues and find the involved own components?
The single Exeptions will come with single comments.

Its not allowed for me to publicate source code. But in summary its:
I disabled all other pages, so just one ListView Page stayed.
The ListView uses:

  • Grid->StackLayout->ListView->ItemTemplate->DataTemplate->ViewCell->CustomCellAsOwnXamlCs
  • Activity Indicator as Overlay if:
    -> List Filter Changes (Async Request to Server)
    -> pagination happen

In the CustomCellAsOwnXamlCs there are:

  • 3 nested Grids
  • a stack layout
  • ffimageloading:CachedImage: with Code Behind Success, Preload & ErrorHandler
  • ActivityIndicator & more

Usually with good Internetconnection, "without" power using the app:

  • set filters with network link contitioner enabled to 50k Modem
  • change filters while loading
  • scrolling

... no exception happen

Issue 1 (Due i cannot reply to my own discussion)

  • was reproduceable until ffimageloading loaded the highres images
  • solved by: in CustomCellAsOwnXamlCs inner Grid wich:
    • holding a Grid with no definitions everything in row/column 0:
      • Image Loading Failed ErrorImage (due custom dimension was needed and aspect from ffimageloading did not matched with our design with frame and rounded corners and more)
      • the ffimageloading Image
      • the activity Indicator
        ... solved by: either removing ColumnDefinition Width="*" ...which should be the default or naming this grid Item ...

" at Xamarin.Forms.Grid.MeasuredStarredColumns () [0x00179] in amarin.Forms.Core\GridCalc.cs:434
at Xamarin.Forms.Grid.MeasureAndContractStarredColumns (System.Double width, System.Double height, System.Double totalStarsWidth) [0x00000] in amarin.Forms.Core\GridCalc.cs:375
at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0010e] in amarin.Forms.Core\GridCalc.cs:509
at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in amarin.Forms.Core\GridCalc.cs:58
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
at Xamarin.Forms.Platform.iOS.ListViewRenderer.OnHeaderMeasureInvalidated (System.Object sender, System.EventArgs eventArgs) [0x00021] in <18e93b810a4a4e2f919016f742528d37>:0
at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
at

Answers

  • boberbober Member

    Issue 1

    • was reproduceable until ffimageloading loaded the highres images
    • solved by: in CustomCellAsOwnXamlCs inner Grid wich:
      • holding a Grid with no definitions everything in row/column 0:
        • Image Loading Failed ErrorImage (due custom dimension was needed and aspect from ffimageloading did not matched with our design with frame and rounded corners and more)
        • the ffimageloading Image
        • the activity Indicator
          ... solved by: either removing ColumnDefinition Width="*" ...which should be the default or naming this grid Item ...

    " at Xamarin.Forms.Grid.MeasuredStarredColumns () [0x00179] in amarin.Forms.Core\GridCalc.cs:434
    at Xamarin.Forms.Grid.MeasureAndContractStarredColumns (System.Double width, System.Double height, System.Double totalStarsWidth) [0x00000] in amarin.Forms.Core\GridCalc.cs:375
    at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0010e] in amarin.Forms.Core\GridCalc.cs:509
    at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in amarin.Forms.Core\GridCalc.cs:58
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.Platform.iOS.ListViewRenderer.OnHeaderMeasureInvalidated (System.Object sender, System.EventArgs eventArgs) [0x00021] in <18e93b810a4a4e2f919016f742528d37>:0
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at

  • boberbober Member

    Issue 1

    • was reproduceable until ffimageloading loaded the highres images
    • solved by: in CustomCellAsOwnXamlCs inner Grid wich:
      • holding a Grid with no definitions everything in row/column 0:
        • Image Loading Failed ErrorImage (due custom dimension was needed and aspect from ffimageloading did not matched with our design with frame and rounded corners and more)
        • the ffimageloading Image
        • the activity Indicator
          ... solved by: either removing ColumnDefinition Width="*" ...which should be the default or naming this grid Item ...

    " at Xamarin.Forms.Grid.MeasuredStarredColumns () [0x00179] in amarin.Forms.Core\GridCalc.cs:434
    at Xamarin.Forms.Grid.MeasureAndContractStarredColumns (System.Double width, System.Double height, System.Double totalStarsWidth) [0x00000] in amarin.Forms.Core\GridCalc.cs:375
    at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0010e] in amarin.Forms.Core\GridCalc.cs:509
    at Xamarin.Forms.Grid.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002a] in amarin.Forms.Core\GridCalc.cs:58
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.TemplatedView.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0003c] in amarin.Forms.Core\TemplatedView.cs:39
    at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\VisualElement.cs:763
    at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in amarin.Forms.Core\VisualElement.cs:645
    at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in amarin.Forms.Core\Layout.cs:131
    at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in amarin.Forms.Core\VisualElement.cs:703
    at Xamarin.Forms.Platform.iOS.ListViewRenderer.OnHeaderMeasureInvalidated (System.Object sender, System.EventArgs eventArgs) [0x00021] in <18e93b810a4a4e2f919016f742528d37>:0
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (Xamarin.Forms.VisualElement child, Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x00090] in amarin.Forms.Core\Layout.cs:354
    at Xamarin.Forms.Layout.OnChildMeasureInvalidated (System.Object sender, System.EventArgs e) [0x00013] in amarin.Forms.Core\Layout.cs:211
    at Xamarin.Forms.VisualElement.InvalidateMeasureInternal (Xamarin.Forms.Internals.InvalidationTrigger trigger) [0x0000b] in amarin.Forms.Core\VisualElement.cs:833
    at

Sign In or Register to comment.