WinPhone 8 SDK breaks backward compatibility

Nov 5, 2012 at 3:51 AM
Edited Nov 6, 2012 at 6:12 AM

Was wondering if anyone else has encountered this.

I upgraded to Win8 / WinPhone 8 SDK, and now Sterling cannot successfully load data anymore.
EDIT: ie: Data that was stored pre-WinPhone8SDK install.

ie: It's not possible to ship an update to an exististing app without some kind of data upgrade procedure - and because the data structure hasn't changed, I'm not sure that any existing data-upgrade strategies are valid - rendering all existing apps using Sterling dead in the water :|

I initially thought it was a change I made, but I reverted back to the code source when the iso storage backup was made, and sterling still cannot read the data.

any help would be appreciated.

Nov 20, 2012 at 9:10 PM

I'm with the same problem, my apps on WP8 are always crashing because of sterling...

Nov 20, 2012 at 11:57 PM

I actually solved this problem, the problem here is that wp8 runtime isn't returning the properties always by the same order meaning that sterling is trying to write values from from prop x on prop y.

To solve this Download the sources, change the SerializationHelper._CacheProperties

And add on the foreach ... properties.Concat(fields) add an order by name .OrderBy(f => f.Name)

 

And that should do it.

Nov 21, 2012 at 3:55 AM

Thanks DVD - but unfortunately I don't think that solves the backward compatibility issue.

Ie: to load data that was stored with binaries deployed with win7.1 SDK - sterling has to load the properties in the order that it was stored - which I'm guessing used to be the order in which they're declared on the class. 

If Sterling is relying on the GetProperties to return the properties in a particular order, I'd be pretty disappointed that this flaw was overlooked:

According to MSDN:
“The GetProperties method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.”

Nov 21, 2012 at 10:15 AM

Yup I understand your issue, as far as Windows Phone goes, I will maintain now 2 versions of my app WP7 and WP8, since my app in WP8 never really worked fine, this wont be a issue.  

Coordinator
Nov 21, 2012 at 11:00 AM

Unfortunately that was an assumption made that as you pointed out is incorrect but was never captured by any test or prior implementation and is now surfacing. Fortunately I have some teams working to correct issues and update the code base. Backwards compatibility may get ugly but I do have a question - the average user won't be upgrading from 7.x to 8.x right? It has to be clean cut-off? Or am I incorrect ... is this an issue with the pre-loaded databases you are shipping or with an on-phone upgrade because the latter won't happen right? It's not a great answer and is some work, but if this is the data you are pre-loading you could write a short utility that gets the property orders in 7.x and then uses that to convert the 8.x to order by alpha, and then the 8.x drivers will consistently order by alpha, and you have two versions of the database, one for 7.x and one for 8.x. Again, working with some teams right now to get eyes on this and evolve it moving forward.

Nov 21, 2012 at 11:08 AM

Just to be clear - the issue is not upgrading the app from 7.x to 8.

The issue is upgrading from 7.1 SDK to 8 SDK.

My app is still targeting the 7.x platform - but it seems the 8 SDK now changes the behaviour of GetProperties(), and as a result cannot load any data that was stored in previous versions that were built using the 7.x SDK.

ie: I cannot ship an update to my 7.x app, because I've now upgraded to the 8 SDK (without which I cannot make apps for win phone 8)

You can see how serious this issue is.

The only current work-around (which I haven't tested yet) is to load 7.1 SDK on another machine, import the source from the repository, and compile the binaries for release.

Coordinator
Nov 21, 2012 at 11:11 AM

Got it - understood. This will take some thought. The only thing I can think of high level (and again, not a great answer, I know) is to release a patch from the former SDK that converts the data and applies the get properties ordering, and then update the 8.x SDK, so it would require two updates, one to "patch" to the ordered properties and two to pick up the newer code generated from the 8.x SDK. I'll continue to brainstorm other ideas to hopefully minimize the impact of this if possible.

Nov 21, 2012 at 11:16 AM

... also keep in mind that developers may want to offer an upgrade path from 7.x apps to 8.x apps.

Ideally when I upgrade my app to 7.x, and my user gets a new 8.x phone - he should be able to restore cloud backups that he's made with the 7.x app.

... initially I was using the Sterling backup mechanism to backup to the cloud - but have since switched to a more agile backup solution that is more tolerant of data structure changes between versions (I guess that's the silver lining this issue has highlighted for me)

In an ideal world (if I ever find enough time) - in the short term 7.x and 8.x versions of the apps will be available concurrently. The 7.x market will still remain a large user base for the forseable future.

Nov 21, 2012 at 12:40 PM

InquisitorJax I've two projects one for WP7 and other for WP8. The WP8 solution are just empty projects with links to the sources on the WP7.

Although I understand your problem, with cloud backups.

BTW when you update an app you can submit multiple xaps, for instance one for WP8 and other for WP7

Nov 28, 2012 at 2:35 PM

Just finished copying all my latest source code to a win 7 machine running Win Phone 7.1 SDK, and I can confirm that the restore of the data works just fine there - no loads issues.

ie: I can now confirm the assumptions above (that Win 8 + win Phone 8 SDK breaks any data stored with the previous SDK) 

... at least there's a confirmed work-around :)

Jan 14, 2013 at 11:51 PM

I have an app built using the 8 SDK but compiled for WP 7. I am going to add a Sterling DB to this existing app. At some point in the future, I am going to compile this app for WP 8 as well. When an existing user is running the WP 7 version of the app on their WP 8 device and then updates to the WP 8 version of the app in the future, will this bug affect them?

Jan 15, 2013 at 3:18 AM

If you haven't added Sterling yet - then better to download the source, and update the code to return the properties in a specific order as suggested by DVD.

I don't have WP8 device to say for sure - but I guess that this bug will definitely effect the app - I have quite a few "EndOfStream" sterling exception stack traces from my winphone error log from WP8 devices that I'm guessing this is the cause.

Jan 22, 2013 at 8:33 AM

Does the new 1.6 release address the above issue?

Will be testing it in the next day or 2....

Jan 25, 2013 at 4:13 AM

Seems there is no backward compatibility (at least with my App's data) with data stored with 1.5.

As soon as I update to 1.6 - I get ArgumentOutOfRangeException when trying to load data stored with 1.5.

Hoping 1.6 will at least sort out my WP8 woes. Will update when I know more.

Developer
Jan 25, 2013 at 7:31 AM
Edited Jan 25, 2013 at 7:39 AM

1.6 does indeed not provide backwards compatibility with the data in 1.5. This is because the way of storing data has been changed. Where 1.5 relied on the order of the serialized properties, 1.6 works with a key-value approach. Though we are thinking if there could be a possible solution.

A possible solution could be: if there are no keys present, fall back to the old way. But as the GetProperties isn't guaranteed to return them in the correct order, and there seems to be a difference in WP7 and WP8, I think that might not be a solution at all...

If you can use 1.6 from the get-go, I would expect this wouldn't occur, because of the key-value approach (I realize this isn't the case for you, just stating it for other readers).