111

I have an app with a pivot control. The pivot control has two items (pages), both contain a grid. The grids contain a few buttons and one a map and the other a text block. When the app first runs the pivot works as expected. However, after the app has been running some time, like a day, all the controls on the pivot disappear after pivoting (or swiping). They appear momentarily while swiping, but disappear again once the pivot rests.

Has anyone else experienced this? What could be the cause and solution?

Video: http://www.youtube.com/watch?v=nd7bfTJ53Nk

Code: https://github.com/JamieKitson/TrackLog/

Jamie Kitson
  • 3,714
  • 4
  • 28
  • 45
  • 4
    We have the same problem. Application with background task and pivot. From time to time, not very often we get this problem. We found exception in crash log from our clients, but not in our code: CDirectManipulationPivot::MoveToPosition, exception type: "c0000005 " Stack: CDirectManipulationPivot::MoveToPosition, CDirectManipulationPivot::OnManipulationCompleted, ... CDirectManipulationServer::ServerThreadStatic, RtlUserThreadStart – Michal Dobrodenka Dec 18 '13 at 10:51
  • 1
    Can you elaborate how the app and the issue depends on background agent you disabled in video? – Alex Sorokoletov Dec 18 '13 at 17:13
  • 1
    Can you provide the xaml for your Pivot control and maybe any errors/exceptions shown on the Output console? – Chris Leyva Dec 19 '13 at 13:24
  • @AlexSorokoletov The app and the background agent are one and the same, the bug only happens after the app has been running for a long time, like a day, so it will only happen (afaik) for background enabled tasks. In the video I kill the background task to force it to restart, curing the bug. – Jamie Kitson Dec 20 '13 at 12:05
  • @AlexSorokoletov https://github.com/JamieKitson/TrackLog/ – Jamie Kitson Dec 21 '13 at 11:40
  • @ChrisLava xaml is not very interesting: https://github.com/JamieKitson/TrackLog/blob/master/TrackLog/MainPage.xaml – Jamie Kitson Dec 21 '13 at 11:41
  • @JamieKitson why do you set CacheMode="{x:Null}" on Pivot Items? This is the only place that looks strange to me. – Alex Sorokoletov Dec 21 '13 at 16:38
  • @AlexSorokoletov I don't know, most likely it was a default or I copied it from an example. – Jamie Kitson Dec 22 '13 at 23:38
  • @MichalDobrodenka Do you have `CacheMode="{x:Null}"`? – Jamie Kitson Dec 22 '13 at 23:39
  • can you share the code – techloverr Dec 24 '13 at 13:32
  • @JamieKitson no, I don't have CacheMode="{x:Null}" – Michal Dobrodenka Jan 02 '14 at 10:05
  • did you all ever solve this? we're having the same issue – jchristof Jun 25 '14 at 21:44
  • @jchristof No, but I've stopped developing/using the app. – Jamie Kitson Jun 26 '14 at 22:35
  • There seems to be some known issue with the pivot. I think you shouldn't worry about it. – Anas Imran Tasadduq May 13 '15 at 12:48
  • @AnasTasadduq Should the users also not worry about it when they can't see the controls? – Jamie Kitson May 14 '15 at 09:39
  • Yes, you can tell the users to restart the application if this occurs or not leave the application open for such a long time in the first palce. – Anas Imran Tasadduq May 14 '15 at 16:00
  • @AnasTasadduq The whole point is that it runs in the background. – Jamie Kitson May 14 '15 at 16:15
  • Oh! Then the only solution seems to be is to restart the application when the problem occurs. – Anas Imran Tasadduq May 14 '15 at 16:35
  • I think the problem might be associated with that map control. Try to subscribe to Pivot's SelectionChanged event and remove the map from visual tree when user goes to another pivot item and add it back when he goes back to pivot item with the map. In the past I worked on an app which also had a map control in a pivot and it caused all sorts of problems. – Lukáš Neoproud May 29 '15 at 21:45
  • A shot in the dark will be to also check if the user is disabling the app or any services it may rely on or goes in a battery saving mode. This may probably stop something you rely on but haven't accounted for. – Pavel Donchev May 31 '15 at 04:02
  • @LukášNeoproud I don't think all the other people having this issue are also using the map control. – Jamie Kitson Jun 01 '15 at 08:53
  • @PavelDonchev The issue is happening to *me*. – Jamie Kitson Jun 01 '15 at 08:54
  • @AnasTasadduq Well done. – Jamie Kitson Jun 01 '15 at 08:56
  • @JamieKitson I understand. Still - is it possible that the phone is in battery saving / have your app or services your app relies on stoppe / suspended / etc? – Pavel Donchev Jun 02 '15 at 08:38
  • a workaround might be to run code that grabs a shot of a part of the UI (say a small box the middle of the screen) and if it sees just black there (or whatever is the current background color) then it would rebuild the UI. That should work then unless the issue is that the app is running low in memory or other resources (could check that with a code profiler I guess) – George Birbilis Jun 13 '15 at 20:39
  • i dont' know how is going in windows mobile but in android this is also can happen, you need to reload the instance from the beginning... – Proxytype Jun 28 '15 at 00:18
  • I reproduced it on Windows10 too. After some swiping Pivot can loose controls. We simply removed Pivot for now. – norekhov Jun 29 '15 at 15:25
  • We have similar issues on windows phone. It happens to both pivot and panorama controls although on panorama it manifests itself a bit differently - after going to a page it shows entrance transition, displays content normally for a split second the goes to the left side as if the entrance transition is not complete. – root Jul 02 '15 at 12:44
  • We were fixing a memory leak occurring after extensive use of unmanaged resources (camera, QR reader), we managed to clear all leaks nicely when we started to get this issue more often even with lots of memory available. My guess it's resource lack but not necessarily memory. – root Jul 02 '15 at 12:52

2 Answers2

1

Quite old question, but still unanswered. It seems like it's because of Application_Deactivated event handler, which runs when application is sent to background:

private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
     diagLog("Deactivated, reason: " + e.Reason);
}

In this event handler you should set RunningInBackground = true

Hope that helps

Galma88
  • 2,061
  • 6
  • 27
  • 45
Umriyaev
  • 990
  • 9
  • 17
0

I am facing the same issue, and its solved weirdly.

If I use Grid inside PivotItem this Issue comes but when I use some other control like StackPanel or something else it works fine.

Rahul Sonone
  • 2,247
  • 1
  • 20
  • 36