Lessons learnt building the Windows Phone OData browser

One of the reasons for re-building the OData browser for Windows Phone was to experience first hand the issues our developers face when writing an app for the marketplace that uses the client library my team produces. This blog post describes what I learnt as a developer on the OData browser and what feedback the team received after this exercise.

Disclaimer : I wrote a lot of the code for the browser such as metadata parsing, dynamic service access without client types and other features for the Silverlight version of the OData browser. About 40% of the code for the Windows Phone browser was brought over from the Silverlight version. The rest of the 60% of code is in the UI and the tombstoning management of data in the app.

The Good :

1. The client library’s events the app depended upon were still present and worked just as well.
2. The OData library had no issues at all with feeds of any kind ( paged/non-paged/with count ) , it worked without a hitch.
3. The databinding classes worked fine for the Phone environment and completion fired events on the right( UI ) thread. 
4. Tombstoning for DataServiceCollection and DataServiceContext works quite well for the rows in the app.
5. The platform is quite nice for debugging on the physical device. Other than some really convoluted tombstoning issues, VS and the debugger chugged along just fine.

The “Needs Improvement”:

1. The DataServiceCollection.LoadAsync<T> api doesn’t return an IAsyncResult when you call it.The reason this is important is because  the marketplace’s certification requirements state that long running network tasks need a “Cancel” button. And the way to cancel a request made by the OData client library is to call CancelRequest on the DataServiceContext instance being used by the app. Since I was using DataServiceCollection in my app and kicking off requests using the LoadAsync and LoadNextPartialSetAsync apis, I couldn’t cancel the current request without a rewrite. Finally, I had to stop using the LoadAsync API on the collection and moved to using DataServiceContext.BeginExecute<T> which does return an IAsyncResult and I could CancelRequest when the UI shows the “Cancel” button.
2. No Credentials support via UseDefaultCredentials and Credentials properties on the DataServiceContext  type. This prevented me from adding support in the app for authenticated services.
3. The emulator is slow on my laptop, I may have to buy a new laptop if I want to use the emulator for developing apps.And here’s a joke for sticking so far with this blog post.
    How slow is it ?
It’s so slow that the January update for the Phone will be released by the time the emulator starts.

I am looking for other perspectives on developing apps for the marketplace with the OData client library.
How do you find developing with the client library on the Phone ?
What are your pet peeves ? and What are the top features you love ?