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 on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
With Xamarin.Forms 126.96.36.19959 running the app on a device Lumia 930 WP 8.1
If you try to set Application.Current.MainPage to a static instance of a Page you it will thow the following exception: "Element is already the child of another element"
follows a code sample that reproduces the bug.
** just click on the "Login" button (no need to type any username or password);
** and on the next page access the main menu;
** and click on the "Reproduce the bug" button to see what happens (running on WP);
On android it work correctly.
I am not seeing the sample you are referencing. Can you please attach it? Marking as NEEDSINFO for now. Please mark as NEW once you have provided the sample.
Follows the link to the sample I'm referencing (the zip file of the solution is too big to be attached on bugzilla).
This sample is just to illustrate the problem.
On my real application I'm not storing the Pages instances as static members, instead I'm using autofac DI framework and registering my Pages as "SingleInstance" but for simplicity of reproduction of the problem I created a new project using Page instances stored (declared) on static members os a class.
Note that the issue just happen on WP, but work perfectly on Android Emulator.
Is there a roadmap of when this bug will be squashed ?
There were a series of issues this repro brought up. Technically the pages were being multi-parented because the MDP was not checking that the page was not already parented. This has now been fixed which would cause this repro to throw an exception now that makes more sense.
However the root issue is also fixed now. If you either retain the MDP used in the repro or somehow deparent that static master and detail before adding them to a new page, it will work as expected.