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.
ContentPage is unable to dispose if a child is a ListView when unloading.
You have a MasterDetailPage as MainPage. Load a ContentPage as Detail. The ContentPage contains a ListView. When you set another page as Detail the old page is unable to dispose the ListView.
Steps to Reproduce:
1- Create a Portable project.
2- Add a MasterDetailPage to the page you will load as Main page.
3- Create a ContentPage and put a ListView and a button in it.
4- Do not use any platform specific renderer on the ListView
5- Fill the ListView
6- In the clicked handler of the button set a new empty page to the app:
App.Current.MainPage = new ContentPage();
7- Set the ContentPage as Detail that you created in step #3
8- Run the app (ListView fills)
9- Click the button.
You should get a System.NullReferenceException
You shouldn't get a System.NullReferenceException
As a workaround I created a ListViewRenderer for iOS like:
public class CustomListViewRenderer : ListViewRenderer
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
protected override void Dispose(bool disposing)
When I comment out the //base.Dispose(disposing); line then the app works.
PS: I'm sorry that I am unable to create a sample app right now.
I am not able to reproduce this but would like to get more info. Can you please verify the Forms version, iOS version, and device or simulator, and possibly upload a reproduction? I've put the ContentPage as the Detail with the ListView and button, and clicking the button sets App.Current.MainPage to a new ContentPage. Clicking that does not appear to cause a crash on my simulator running 10.2.
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!