Xamarin.Forms Attempt to read from field ‘int android.view.ViewGroup$LayoutParams.width’ on a null object reference

One of my forms started crashing after Xamarin.Forms update (I haven’t investigated which update broke this code)  Can you spot what’s wrong with this code (simplified)?

Screenshot 2020-01-30 at 09.37.19

This results in this following error box which was driving me crazy:

Screenshot 2020-01-30 at 09.33.23

Well, turns out that the “VerticalOptions=”End” is the code part that has been crashing the page all this time. I know this is not good coding (not to have some kind of layout on the ContentPage – but why does this crash? I don’t understand but note-to-self about this error message for the future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s