3

I have a MapControl on my MainPage with ItemsSource binded to a ObservableCollection (via x:Bind). When I navigate to another page and then back again, the app crashes randomly (about every 5th time) and without any hint what the problem might be.

I have found a workaround with setting the ObservableCollection to null when navigating from my MainPage and set it back to the backed up value when navigating back to it. But as this is a very unpleasant workaround I am wondering what the reason for the crash could be...

My app is a Universal Windows 10 app. Crash appears mobile as well as desktop.

tipa
  • 369
  • 1
  • 5
  • 17
  • I sometimes also experienced the crash when resizing the windows with the MapControl visible – tipa Aug 31 '15 at 18:58
  • a little code please! – Shahriar Sep 01 '15 at 09:49
  • I have a page with a map control that I can navigate from and to on uwa 10 and I don't have any problem .. we need some code . – Amine Da. Sep 02 '15 at 17:16
  • I agree ! did you find any solution? – Amine Da. Oct 13 '15 at 20:26
  • I worked around by setting the ItemsSource, the MapControl is binding to null and refreshed all bindings in OnNavigatedFrom. After navigating back, I am setting the ItemsSource back the the (previously cashed) value and again, refresh all bindings. – tipa Oct 13 '15 at 22:08

1 Answers1

1

Looks like you have a memory leak. You can run diagnostic in visual studio and see it. In map_unload event you can set to null your collection and iterate for Map.Children and set each element to null (Map.Children.ToArray()[i] = null). Maybe it will help you.

igoryok_d
  • 11
  • 1