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!
However, because Windows Phone 7 is still under development, early adopters sometimes need to deal with a few rough edges...
- Downloaded source code from my blog, unblocked the ZIP file, and extracted its contents.
- 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. - 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 toWMAppManifest.xml
in theProperties
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> ...
- 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. TheSystem.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 theSystem.Windows.Controls.dll
assembly it depends on is from the November 2009 Silverlight 3 release of the Silverlight Toolkit and is signed. - 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!
- 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. - 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.]