Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 44910 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 17819 [details]
Solution for reproduction, including git history
In Page.OnAppearing, adding children to a StackLayout that was previously empty (and thus had a width and height of zero) causes a NullReferenceException in Xamarin.Forms.StackLayout.AlignOffAxis.
This bug is a regression introduced by: Xamarin.Forms.188.8.131.5221
Latest working stable version: Xamarin.Forms.184.108.40.20605
**Steps to Reproduce**
1. Run the attached sample on iOS (tested on simulator, but same issue on device)
2. Tack any of the two buttons on the welcome page
The application crashed.
Should show the expected page with Label + Switch at the bottom of the page.
**Build Date & Platform**
Mac OS X 10.11.6
Xamarin Studio 6.0.2 (build 73)
iPhone Simulator 9.3.5
The attached archive contains a git repository allowing you to test with the latest working version and the first crashing version.
Thibault, please see my comments on GitHub. This seems to be a problem with horizontallayoutoptions and padding (only top or bottom) being set at the same time when the page is pushed on the navigation stack. Seems like layout calculations are messing up.
I made some changes to StackLayout so that it doesnt crash. Instead, it calculates layout to proceed.
Thank you for your PR and comments on this issue.
I apologize for not being very engaged in the folluw-up of this issue: The main reason is that I found a work-around (not modify the StackPanel in OnAppearing) and reported this issue only after I published my app with the work-around.
So my report was more for the Xamarin team to be aware of this regression rather than to get a fix ASAP.
The other reason is that I'm not very used to contributing to open-source projects and I don't really know where to start. Since this discussion is not relevant for this issue I've contacted you via PM on the forums.