The blog of dlaa.me

The joys of being an early adopter... [Upgraded my Windows Phone 7 Charting example to go with the April Developer Tools Refresh]

Last week saw the release of the Windows Phone Developer Tools CTP - April Refresh, a free set of tools and an emulator that lets everyone get started writing Windows Phone 7 applications. Not only is the application platform for Windows Phone 7 based on the same Silverlight framework many of us already know and love, but the tools run on any standard Windows machine and the inclusion of the device emulator means you can test apps on the device without having a device. It's a great developer story and I'm a big fan!

Sample in portrait orientation

 

However, because Windows Phone 7 is still under development, early adopters sometimes need to deal with a few rough edges... :) I'd heard of occasional difficulties when folks tried to update their applications to run on the April Tools Refresh, so I thought it would be a good learning experience to update an application myself. The obvious choice was my "Silverlight Data Visualization assembly running on Windows Phone 7" blog post sample. Here's how it went for me on a machine that already had the April Refresh installed:

  1. Downloaded source code from my blog, unblocked the ZIP file, and extracted its contents.
  2. Opened DataVisualizationOnWindowsPhone.sln in Visual Studio - which immediately showed a message that I was using a solution created with a previous release of the tools and listed a specific change that needed to be made to one of the files.
  3. I would have been happy to let the tool make that change for me, but it didn't offer to, so I added the 9 new Capability entries to WMAppManifest.xml in the Properties folder just like it suggested:
    ...
    <Capabilities>
      <Capability Name="ID_CAP_NETWORKING" />
      <Capability Name="ID_CAP_LOCATION" />
      <Capability Name="ID_CAP_SENSORS" />
      <Capability Name="ID_CAP_MICROPHONE" />
      <Capability Name="ID_CAP_MEDIALIB" />
      <Capability Name="ID_CAP_GAMERSERVICES" />
      <Capability Name="ID_CAP_PHONEDIALER" />
      <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
    </Capabilities>
    ...
  4. I tried running the application, but got a blank screen in the emulator and the dreaded FileLoadException that results from a bug in the April Refresh where it fails to run any application referencing an assembly with a digital signature. The System.Windows.Controls.DataVisualization.Toolkit.dll assembly used by the sample is from my Developer Release 4 which I build myself and don't sign, but the System.Windows.Controls.dll assembly it depends on is from the November 2009 Silverlight 3 release of the Silverlight Toolkit and is signed.
  5. So I stripped the signing from the Silverlight Toolkit assembly using the steps Tim Heuer outlines in this blog post and replaced the signed assembly with the unsigned version I'd just created.
    Aside: Yes, this is super-goofy - but I'm told it's going to be fixed!
  6. Having done that, I tried running the application again, but got the error "Object reference not set to an instance of an object.". But because I ran into that same problem with the previous tools release, I knew to open MainPage.xaml in Visual Studio and try running the app again.
  7. This time around, it ran successfully and I spent some time admiring the beautiful pie chart in all its portrait and landscape glory. :)

 

So, when all is said and done, this ended up being more involved than I expected - but once I jumped through the hoops, my sample application worked exactly the same as it did when I wrote it. I'm happy to report that Charting still runs fine on Windows Phone 7 - and that I've updated the source code download with these changes so nobody else needs to repeat the process! :)

 

[Click here to download the updated Windows Phone 7 Data Visualization sample application.]