“It was the best of times, it was the worst of times…”

It was with these famous words that Charles Dickens began his book A Tale of Two Cities, “It was the best of times, it was the worst of times…”, while he was referring to one of history’s most explosive eras, he might have also been writing A Tale of Two Apps.

Windows Phone developers, at least good developers like yourself, will test their application thoroughly before submitting it to the AppHub for certification; few developers unfortunately test the update process for their application.

It is here that we encounter the Tale of Two Apps, an earlier version of your application has been installed on the users phone for sometime and it has created several objects within isolated storage; subsequently a newer version of your application is certified within the AppHub and published to the marketplace.

“It was the best of times…”

You receive the notification from Microsoft that your app has passed certification and you publish it to the marketplace waiting to hear what your users think of the latest features you have worked tirelessly upon for weeks.

“It was the worst of times…”

You begin to see feedback from users indicating that your app is crashing following the update, what could possibly have gone wrong?  You tested the new version of your application before submitting it to the AppHub for certification. It passed the certification testing and was ready for publication, or so you thought…

Within the new version of your application, following the update, an exception is being thrown when the application attempts to deserialize the objects in isolated storage, but one or more of the object definitions have changed.

It definitely was the worst of times although it’s a lesson that you will never forget and so you need to test the update process before submitting any updates to the AppHub for certification although exactly how do you test the update process?

Using the Windows Phone application deployment tool, provided with the Windows Phone SDK, you can deploy the current version of your application to the emulator or device. Once deployed, run the application such that objects are serialized to isolated storage. Using the deployment tool once again, deploy the updated version of your application to the emulator or device. Once deployed, running the updated version of the application will result in the new version attempting to deserialize objects created with the earlier version.

It may also be useful to inspect objects within isolated storage using the Isolated Storage Explorer or Windows Phone Power tools created by Oren Nachman.

“It was the best of times…”

You now have a way to test the update process of your Windows Phone applications to ensure that the update is also “the best of times” for your users.

Update 12/7/2011 – Published Debugging the Update Process for Windows Phone Apps as a follow up blog post exploring how you can debug the update process within Visual Studio.