Saturday 14 December 2013

WP7 Run Under Lock Screen Mystery

My son just returned from the Varsity Ski Trip, and used Skied Demon on a Windows Phone 7.  Now I know there aren’t many people out there who actually have one of these phones, and we rewrote the software to work while making phone calls on WP8, however, it still irks me when code we wrote doesn’t work for some of our customers.

The problem goes like this:

My son starts logging in the app, and then presses the power button to lock the screen and save power.

Later, he sees something that requires a photo and presses the camera button to wake up the phone.

After he backs out of the camera, he finds that the program is no longer running.

Of course, while on holiday, he had better things to do than tell his father an app isn’t working like he thinks it should be, but now he’s back, I’ve looked into the cause (30 minutes from bug report to investigation.  That’s how we like to treat all bug reports, so if one of our apps crashes, let us know, and we’ll investigate).

It turns out that the software is  getting a RootFrame_Obscured message, when he presses the lock screen.

When the camera button is pressed, an Application_Deactivated event is raised, my state is stored, and that’s the last my code ever sees of any execution time.

The program does have a background XNA thread for audio that’s raising a System.Threading.ThreadAbortException in Microsoft.Xna.Framework.dll before it exits however.

Any suggestions?

Sunday 1 December 2013

NullReferenceException in AdDuplex

We recently switched over to AdDuplex in our trial apps to get some extra promotion, as using the Microsoft PubCenter.

Last night, while waiting around, I started playing with one of them, and found that the app would crash, with the following call stack when connected to BTOpenZone, but not logged in.

System.NullReferenceException
Object reference not set to an instance of an object.
   at AdDuplex.AdControl.OnNetworkManagerAdLoaded(Object sender, AdLoadedEventArgs e)
   at AdDuplex.Models.NetworkManager.OnAdLoaded(TextAdInfo newAd)
   at AdDuplex.Models.NetworkManager.<>c__DisplayClass2.<LoadNewAdCallback>b__0()

I vaguely remembered seeing an update to the AdDuplexW8 nuget package midway through my updates that said that it fixed a null reference problem.

Obviously, this was it.

So, if you’re not using AdDuplex.WindowsPhone version 2.8.0.4 or later, you’ll need to rebuild your apps and resubmit, or else your app too will crash.