I have to admit that the last 2 Bingle Maps updates were a total mess. Beginning with version 1.5 crashing all around when starting, sleeping, and exiting the app after updating from a previous version, then there’s this not-any-better version 1.6, which silences the crashes but made the app not saving any data at all!
I have to apologise to all of the users out there who’s experiencing these frustrations and am grateful for those who sent in the error reports and the helpful feedbacks.
1.6 was pulled from Market place as soon as I realised the situation, and 1.7 – which is suppose to end all this madness, was submitted to App Hub yesterday. While waiting for Microsoft to test and certify the new version which usually takes a week, I decided to put down some details on what has really happened to the last 2 updates, technically.
It all starts with auto complete
The first new feature I implemented for version 1.5 was auto complete for the search and direction finding boxes. This required some structure changes in one of my data model, which is saved and loaded when the app starts and exits. This is the very culprit for all of those crashes. But how can I not have caught this during my testing?
Turned out that the crashes would only happen if 1.5 tries to load the saved data from a previous version, and this only happens once. This is because I use Silverlight Serializer (SS) to serialise the data to isolated storage, and SS is a binary serialiser, which does not deal with data structure change very well. Therefore, when 1.5 starts for the first time after updating, SS tries to deserialise the old binary data into an updated 1.5 object, which then causes the first exception. This exception stops all other necessary initialisation of the app leaving the app in a half broken state. When you sleep or exit the app however, since there was no data loaded, the app will do a clean up in the isolated storage so that the next time the app starts, it starts anew. This is exactly why the crashes only happens once.
Then there was the new WP7.1 SDK
Half way through 1.5, the WP7.1 SDK beta 2 was released and as a developer I upgraded my phone to a Mango dev build as soon as I can. I was amazed by how far Mango has reached and excited about all of the new features in the SDK. So I quickly wrapped up 1.5 with some extra performance improvements and decided to update the whole project to 7.1. While I was at it, I figured that it was a good chance to also update all third party libraries that the app uses to their latest version too, such as RestSharp and DropNet, and of course the Silverlight Serializer.
Not long after that, I started getting tons of error reports due to the 1.5 crashing bug. It was till then I realised that it was a huge mistake to rush updating everything to the latest version before making sure that 1.5 was all OK. Because once the project is updated to target the 7.1 runtime, you can’t downgrade back to 7.0. So I had no choice but to revert back in my version control history.
That was a real harsh lesson for me to completely understand how crucially important it is to keep your version control history nicely commented. All of my SVN check-ins were made without comments and there are thousands of them. So after hours of looking at the file diffs in WinMerge, I finally reverted the project back to where I pushed out 1.5, EXCEPT forgetting the updated Silverlight Serializer.
The new Silverlight Serializer is targeting Silverlight 4 framework, which is incompatible with the Silverlight 3.7 CLR running on all of the devices out there. But guess what, I never had a chance to catch this (again) because my phone was running Mango, which has Silverlight 4 CLR. So again, I foolishly thought that I had patched up the 1.5 bug and submitted 1.6 to App Hub. You probably know the rest of the story from here.
One thing surprises me is that the App Hub QA team didn’t run into this bug either. The whole testing and certification process was smooth for 1.6 and it was published to Marketplace within a week. Does it mean that they are using Mango phones to test the new submissions now?
So what’s now
Finding out that 1.6 became a bigger disaster was a nightmare to me. I realised that I really have to clean this up and do it properly from now. So I started re-organising my SVN repo into Git and established proper branches just like an enterprise development project. I then wiped the Mango rom on my phone after that, re-flashed the factory rom, went through the lengthy Zune update process and finally got the phone back to official NoDo environment. From here I could test the re-compiled Silverlight Serializer for 3.7 CLR and made sure every thing works fine on a normal NoDo device.
So 1.7 was submitted and it is running fine on my NoDo phone now. Hopefully this would put an end to the madness. I’d label this as the worst disaster in my development experience so far. But I guess sometimes the most valuable things can only be learnt from the toughest lessons.