Saturday, June 15, 2013

Renewing a Windows Phone developer subscription with an MSDN token

For the last 3 years I've paid (yes, with real money) for my Windows Phone developer subscription. As I've just come up for renewal again I wanted to use the token I get as part of my MSDN subscription (that I also pay for).

In the phone dev centre there was a nice link prompting me to renew. On that renewal page there was an option to pay for renewal or enter a code. Obviously I wanted the "enter a code" option but where to get that code from? Unfortunately it wasn't as easy to find as I would have liked so I thought I'd share it here.

It's actually quite simple (once you know how)

  • Log into your account on msdn.microsoft.com.
  • Got to https://msdn.microsoft.com/en-us/subscriptions/manage/
  • Under the Subsccription Benefits find "Windows Phone developer account"
  • Click on the "get code" link to reveal your code - it is a GUID
  • Enter that code (GUID) in to the phone dev center renewal page.
  • Done!

Hope this helps.



Wednesday, June 12, 2013

ShellTile.ActiveTiles sometimes forgets about one of the tiles

A couple of times, when working with an app with lots of tiles pinned, I've seen `ShellTile.ActiveTiles` "forget" about one of the tiles.  By that I mean that when updating all the tiles from a background agent one of them isn't updated.

This is with code like:

    foreach (var tile in ShellTile.ActiveTiles)
    {
        // update the tile.
    }


At the moment I only have anecdotal evidence of this behaviour but wondered if anyone else could shed any knowledge or experience of this while I continue to investigate.

Deleting and repinning the tile in question seems to make the problem go away but this isn't a real solution.
Additionally it doesn't seem like it's the first or last created pin but I can't be sure of this.

Has anyone else seen this?



Saturday, June 08, 2013

LongListSelector does not "play nicely" with a static DataContext

Here's a lesson from a day lost to debugging an obscure issue.

Microsoft recommend that you should "use the LongListSelector instead of ListBox for phone apps".

That's great advice, especially if upgrading an existing app where ListBox wass used previously. But there's a gotcha you may need to be aware of.

If a LongListSelector is bound to a static ItemsSource then a reference is held that stops the page being collected. This means that such a page would leak memory!
If it's a large or complex page or one that is opened a lot (so you end up with lots of copies in memory) this could be very bad for your app.

This doesn't happen when bound to a non-static source. It also doesn't happen when using a ListBox bound to either a static or non-static object.

If you're upgrading an app built several years ago when using a static view model seemed like a not unreasonable way to architect an app you may be more likely to hit this. (That's why I discovered the issue-when upgrading an app originally written in 2011.)


Don't believe me or want to see this in action for yourself?
I've put a project at https://github.com/mrlacey/WPMisc/tree/master/LlsStaticTest which demonstrates all the above.
It allows opening of pages which contain:
  • a ListBox bound to a static object; 
  • a ListBox bound to a non-static object; 
  • a LongListSelector bound to a static object; 
  • a LongListSelector bound to a non-static object; 
  • and a way to force garbage collection.
Each page also outputs creation, navigation and destruction information to the debug window.
To see this in action, open each page then tap "FORCE GC" twice and you should see the destructors for all but the static LongListSelector page being called.
You can also see the same by running the app through the memory profiler but I think it's easier and faster to see this problem via the debug output.

There are two ways to address this issue:
  1. Remove the use of a static view model. Depending on your application this may or may not be a viable solution but I would recommend against using a static view model whenever possible.
  2. Remove the binding when backing out of the page. It feels slightly imperfect but works and is easy to do.

To remove the binding when leaving the page, just do something like this.

protected override void OnNavigatedFrom(NavigationEventArgs e)
{
    base.OnNavigatedFrom(e);
 
    // The following removes the binding of the LLS to the VM
    // so the page can be collected
    if (e.NavigationMode == NavigationMode.Back)
    {
        this.DataContext = null;
    }
}

Note that this is done in OnNavigatedFrom and not in OnNavigatingFrom as if done before you have navigated away from the page the removal of the binding may cause the UI to update and you may see screen flicker before the page closes.

This discovery was found via a lot of experimentation, insight and a process of elimination.I couldn't find any indication of what was holding a reference via the profiler. If you know where this would be indicated (or even hinted at) I'd love to know.



App store credibility

I'm thinking out loud here. If I wander I'm sorry. If I cause you to jump to conclusions, please don't attribute them to me if they're your conclusions rather than mine.

Do apps that get featured in the marketplace/app store matter?
It's been well documented that being featured in the store directly leads to an increase in downloads. In that respect, being featured matters to the person who owns/created the app. But I wonder...

Do they have a bigger impact?
Do featured apps impact more than just those who created or downloaded the app?

Does the quality of a featured app impact opinion on other apps?

If it's the featured app I'd expect it to be either highly popular or (and hopefully "and" as well) of a very high quality.

If a featured app isn't very good (however that's defined) isn't it reasonable to assume that, as a consumer of apps, I should not hope for very much from other apps either? Afterall isn't the purpose of a featured app to highlight something I may want to install and use? Why would something that isn't very good be featured?* You want me to install crummy apps that aren't as good as others which do the same thing?


I see many featured apps that aren't very good, do not give me confidence in the general quality of other apps, are buggy or otherwise very poorly designed. :(

And a related question:

Does the credibility of the store affect apps? and the platfom?
Let's take, as an example, a recently featured app.
I'm anonymising the app in case my comments are taken as being focused directly at the app. That's not my aim. I'm trying to look at the wider picture.

It had no description (just the default text of "Check out this Featured App of the Day!") and a single rating.

That's right the app that the store thinks I should know about today, because it's good, relevant to me or in some other way useful has only ever had a single review. That's not encouraging, because we konw that ratings are a two part feedback mechanism. The number of ratings is an indicator of the number of people who have also used that app - there are very, very few apps with large numbers of users and very few ratings. The average (mean) value of the the ratings (subject to skewing from a small sample size) gives an indication of the quality of the app.

So, from that we can infer that the "best" app in the store today has a small user base. But maybe that's because it's new. Nope. It's had 5 updates and the last of which was 8 months ago.

Maybe the featured app is being targetted directly at me based on some heuristics or algorithm based on my other app and device usage? I doubt it and I hope not because if that's the case the algorithms are way off.

And what of that review:


I've anonymized it because the app in question doesn't count and the review included three potentially offensive words which weren't filtered or masked by the store.

I find the ratings count potentially confusing. It says there was one 4 star rating but we can only see one review. There's lots of potential here for confusion. Can't the store count? And if not what confidence should I put in it?
Actually zero star ratings aren't included in the average. If they were there would be 2 ratings with an average of 2 stars. This would bring average ratings down and so, while potentially misleading, ignoring them improves the overall perceived quality of apps. - I'm not sure what I think about this.
This is a consequence of there not being a way to actually give a no star review because the interface for leaving reviews and ratings doesn't have a way to distinguish between a rating not being left and a rating of zero. Ignoring no star ratings may be preferable to including the scores from reviwers who forget to give a rating though. I don't have the figures to say if this is an issue. I bet the people who are genuinely wanting to leave no star reviews (like the one above) are disappointed their rating is ignored though. Do people realise that zero star ratings are ignored and if you want to rate an app badly you must give it a 1 star review?
Anyway, I think I'm getting off topic.

If the store doesn't look great (i.e. doesn't appear to be able to count) then won't your opinion of the apps it sells be tainted? When you buy something from a physical store does that affect your opinion of the products you can buy in that store?

And what about the store as an app. The quality of it, like any app, impacts the perception of the platform. It's easier to say "that phone's rubbish" rather than "app X on phone Y is rubbish" or "it's hard to find good apps on phone Y".


Am I against apps and their developers getting promotion?

No, I want people to create successful apps. But I'd rather they had an awesome app that was successful, offered real value, helped people and showed what was possible with an app.
The quality of apps impacts the whole ecosystem and that in turn affects all of us, both the consumers and creators of apps.

* I'm aware of some of the finer points about what is featured and the business deals and implications that impact marketplace promotion. I've just chosen to ignore them for the sake of this post. They don't impact every featured app and would just serve to complicate the above thoughts. Anyway - my blog, my rules. ;)

Monday, June 03, 2013