tipa
tipa

Reputation: 437

UAP app crashes when page navigating backwards to page with MapControl

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.

Upvotes: 3

Views: 222

Answers (1)

igoryok_d
igoryok_d

Reputation: 11

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.

Upvotes: 1

Related Questions