Friday, May 29, 2015

Windows 8.1 App Mystery - controls randomly disappear but are still interactive

Late last year my team delivered a Windows 8.1 modern app to our outside sales force equipped with ThinkPad 10 tablets. There were bugs to be worked out, of course, and we've still got plenty to fix. But one problem has been truly discouraging given our inability to reproduce it.

The Problem

From time to time, we'd get reports from sales that the top third of screens in the app would simply disappear, leaving just the background of the screen. The weird thing was that the controls that disappeared were actually still interactive. If you knew where they were, you could tap them and do things. But a horrible user experience, especially when you're in front of a customer.

We even saw this problem ourselves on occasion but couldn't reproduce it. The only way to get around it was to close the app and reopen it.

Over time, we came to see that this problem generally occurred after the device had come out of sleep mode. One of our more observant sales reps pointed this out and stated that if he manually closed the app after each customer encounter, the next time he woke the device and used the app he rarely had the issue.

Reproducing the problem

I ran across two SO threads describing the same exact problem: here and especially here. We could actually reproduce the issue using the method he found:
"I can re-create the problem by going to task manager and creating a dump file for the running app. After I do this twice and resume the app, the two text blocks disappear."
He also described how the use of images was related to this problem. Sure enough, we were using an image for our app's background.

Fixing the problem

We removed the background image and instead used a simple Brush. At that point, we could no longer reproduce the issue using the steps above -- problem resolved.

I'm still not sure why the problem occurred in the first place. Possibly related to the lower memory devices (2GB)? Or maybe just something we were doing wrong in the app when trying to use a background image?