WP7 April refresh? Do YOUR WP7 apps work now? Mine don't!
May
10
Written by:
Monday, May 10, 2010 8:33 PM
hhhhmmmmmmph! After doing all the hub-bub that goes along with REINSTALLING the April WP7 refresh, my WP7 apps don't work! Do your's? Read on for quick fixes.

Ok, so you've heard about the WP7 "April Refresh" which lets you install the latest'n'greatest Windows Phone 7 SDK/emulator with the released version of Visual Studio 2010! AWESOME!!!!!!!!!! TOO COOL! SWEET! Let's go for it!
hhhhmmm uninstall WP7 CTP (last version), uninstall current Visual Studio 2010 RC, and any/all associated installs (something like 80+ EXTRA uninstalls, nasty eh?). Anyways, AFTER all that, you can FINALLY install VS 2010, then the "WP7 April refresh." hhmmm flash for...uh oh.. that's a bad word lately eh.....fast forward an hour........
There, all done? COOOOOOOOOOOOOOOL! NOW you can fire up your latest WP7 pet project, F5 and .....wha.....WTF......? What's this Warning about come Capabilities crap? WTF?
AAAAAHHHHHH Sorry, that's part of the "bleeding edge" you're skating there! Like me, you and I both skated the bleeding edge and got cut, not too badly though. Thankfully we can easily recoup from this one. Short story is you're getting the Capabilities warning cause MS added new security checks to WP7 apps. This is kind of the "declarative code access security model" Microsoft tried to get us developers to buy into a few years ago. Haven't heard about it? Ya, I'm not surprised, there's A LOT of power there which hardly anybody ever uses. The idea behind it, is you, the developer declare a head of time (coding time) which OS features (or Capabilities in our case) you are going to use. If you aren't gonna use it, you don't delcare it, AND if somehow a malictious piece of code is abusing YOUR code, you're app/library and most imporantly, you're client is protected. Well, that's the theory anyways.

In our case, you can see from the picture, the default list, well, lists just about everything you could/would want to use with the phone. Best practises suggests you strip out what you're not going to use. So in other words, if you're making a game, then you should probably remove the lines about making phone calls, web browser, microphone, just as some examples.
AAAAHHHH There we go. Now you can F5! hhhmmmm Emulator comes up, good.... IE logo comes up.......co....what the? My splash screen pops up and then the app closes again! WTF? But Peter, I thought we were good to go? Nope, seems like you ran into an honest to goodness bug from MS. Unfortuantely when MS released the April WP7 CTP, they introduced a bug which won't run your WP7 IF you're using signed assemblies (are you using the Bing maps control?). Tim Heuer talks about it and even gives a PowerShell script you can use to create temporary assemblies/DLLs to use. IF you have PowerShell installed (I didn't install it, crap!) the upside is you can get your WP7 to run without changing/damaging your existing DLLs. The downside is, the PowerShell script creates "sister" DLLs which you'll need to re-Reference in your project and when MS finally DOES fix the bug, you'll have to undo what you just did to get things working yet again. I really hope MS fixes this one ASAP! And NOT with another "Refresh" with with a patch update.
Now that you know how to get your WP7 apps to run, it's time to grab a coffee and get coding!
Resources
Microsoft: Windows Phone Developer Tools CTP - April Refresh
Nick's .NET Travels: Upgrading Windows Phone 7 Projects to April CTP
Tim Heuer: Windows Phone 7 Developer Tools April 2010 Refresh
Jaime Rodriguez: Windows Phone Capabilities Security Model
MSDN: Code Access Security Basics
MSDN: Code-Access Permissions and Security (C# and Visual Basic)