Posts Tagged ‘app hub’

Forcing capability detection in a Windows Phone application

Written by Tom Verhoeff. Posted in MSP, WP7

Last week I blogged about a problem I came across when beta testing a new WP7 application. My problem was related to the ID_CAP_MEDIALIB capability. Today I noticed somebody on twitter having similar issues.
PROBLEM! #wp7dev 's: When submitting an app that uses the video recorder <"ID_CAP_Microphone"> is removed #wpdev
Lance W. McCarthy
Fortunately there is a way to force detection of every capability. The key is knowing what reference to use to force the detection. In this post I will show how to implement a simple workaround to ensure detection. Please note that all of this is just temporary. Microsoft’s engineering teams are working on fixing these detection issues, so these tricks should not be required anymore in the future.

Detection process

First of all it is important to realize that the Ingestion Tool does not scan the actual C# and XAML (that’s not included in the XAP package anyway). The actual scanning happens on the Intermediate Language (IL) that is generated by the compiler. This is important to keep in mind when implementing this workaround.

Detection rules

Essentially both the Marketplace Test Kit and the App Hub itself use the same set of rules to determine what capabilities are required. Fortunately those rules are supplied with the Test Kit in understandable XML format. To find out what class you need to reference to force detection it is sufficient to check this list of rules. The rules.xml can be found in “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\Marketplace” For example here’s the part on the ID_CAP_MICROPHONE capability.
<Capability ID=”ID_CAP_MICROPHONE” Type=”Security”> <Assembly Name=”Microsoft.Xna.Framework, Version=, Culture=neutral, PublicKeyToken=842cf8be1de50553″> <Namespace Name=”Microsoft.Xna.Framework.Audio”> <Class Name=”Microphone” /> </Namespace> </Assembly> <Assembly Name=”Microsoft.Phone.Media.Extended, Version=, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e”> <Namespace Name=”Microsoft.Phone”> <Class Name=”Camera” /> <Class Name=”PhotoCamera” /> <Class Name=”VideoCamera” /> </Namespace> </Assembly> </Capability>

Forcing detection

The rules.xml file basically tells you what classes to reference to force the detection (I highlighted them). In any case you can just add a dummy file (either xaml or just cs) and make a reference to just one of these classes. In case of the Microphone @lancewmccarthy suggests this line:
Microphone microphone = Microphone.Default;
This is a Microphone-specific solution. Another option is to just add this line:
Microsoft.Xna.Framework.Audio.Microphone temp = null;
This is where you need to remember the code gets compiled before scanning. The compiler implements a lot of optimization which in this case would lead to discarding a variable that is never accessed. Adding another line that references the variable solves this. This can be pretty much anything, for example:
If you would actually run this code it will always throw a NullReferenceException, but since this is a dummy file that will never happen. Although the code is unreachable the ingestion tool notices it. You can use the Marketplace Test Kit to verify this. capabilities


By combining the information in the rules.xml with a simple dummy file you should be able to force detection of any capability. The other way around rules.xml can also help you identify why a certain capability gets detected. Do you come across any problems when using this method? Feel free to leave a comment or send me a tweet.

Marketplace fails to detect capabilities, causes crash

Written by Tom Verhoeff. Posted in MSP, WP7

Those of you following me on Twitter might have noticed some complaints about the beta version of one of my new applications not working the way it should. The app implements a BackgroundAudioAgent to play an audio stream. When directly deploying the XAP to a device this works like a charm. For a last round of testing I submitted the app for private beta testing through the App Hub. To my big surprise the version downloaded through private beta instantly crashes when trying to start the backgroundagent. Apart from analyzing, signing, encrypting and repackaging the XAP nothing should be changed by the private beta process, so this should not be possible.


We investigated the problem together with the Microsoft Marketplace Dev Support team. We figured out the crash was related to the specified capabilities. To play background audio the agent relies on the ID_CAP_MEDIALIB capability. This was specified in our manifest-file, but during the submission process the required capabilities are analyzed and overwritten. Apparently the App Hub contains a bug causing the medialib capability to remain undetected in certain situations. When using the Marketplace Test Kit the same problem shows, it does NOT detect the medialib capability. When the application tries to execute any action related to this capability it simply throws an exception and crashes.


Obviously this is a bug in the Marketplace Ingestion tool that Microsoft needs to fix. The support team states: “I can tell you that it’s a known problem at our side that Engineering Team is already investigating”. Fortunately there’s a pretty obvious and easy workaround to solve this problem. Just add a “dummy” page to your application. Add elements to this page the ensure detection of the missing capability. In my case we forced detection of the MediaLib capability by inserting a MediaElement and making sure at least the x:Name is specified( <MediaElement x:Name=”DUMMY” />). Now both the Marketplace Test Kit and the App Hub’s ingestion tool will detect the capability therefore solving the problem. Update: The support team also provided me with some other workarounds that are easier and cleaner, but still force detection of the missing MEDIALIB capability. If your app is referencing any of these libraries just add the one line of code to your app.
If it’s referencing: Then add:
Microsoft.Phone.dll Microsoft.Devices.MediaHistory history = null;
Microsoft.Xna.Framework.dll Microsoft.Xna.Framework.Media.MediaLibrary lib = null;
none of the above ones, so very likely it’s at least referencing System.Windows.dll System.Windows.Controls.MediaElement me = null;
I don’t know if anybody experienced problems with apps crashing after going to the marketplace submissions process, but the first place to search for errors appears to be the detected capabilities. The Marketplace Test Kit performs the same analysis the marketplace does, so it’s easy to check. The engineering team is working on fixing the issues, but for the time being forcing detection by adding dummy elements is easiest workaround.

Removing old/beta applications from the App Hub

Written by Tom Verhoeff. Posted in MSP, WP7

A while ago I blogged about one of the most useful features introduced with the new App Hub: private beta distribution. I have to admit, I use this one pretty often. Updating is not supported for beta’s (vote here if you would like it to be), so with every app I build my list of apps grows bigger and bigger. Unfortunately Microsoft appears to have missed a pretty obvious option, the actual deleting of beta’s that are finished anyway. I am able to end a beta, but it keeps showing up in the list.To keep thing manageable I decided to fire up my favourite tool Fiddler again. It helped me out with App Hub exceptions before and to my big surprise Fiddler again is the solution here. It does take some effort, but at least it keeps your App Hub account nice and tidy.
Notice the missing "Delete submissions" button

Notice the missing "Delete submissions" button

Dummy artwork for private beta submission

Written by Tom Verhoeff. Posted in MSP, WP7

Yesterday I published a blog about private beta testing, one of the great new App Hub features. Although the feature itself is great part of the process can be a little frustrating. One of the things that frustrated me was the requirement to submit the full load of artwork. In the first stages of testing I usually don’t have all the artwork/screenshots finished yet, which in the end forced me to create some dummy artwork. The same holds when you don’t want your artwork to be available yet before the official launch of your application. To save some frustration in the future I will just share my dummy artwork. I did not try to give it any kind of design so it’s ugly, but at least it will be accepted by the App Hub. Feel free to use it in your beta tests. Here’s a zip containing all the files. Happy beta testing!  

Using private beta distribution for testing your WP7 app

Written by Tom Verhoeff. Posted in MSP, WP7

A while ago Microsoft introduced a big improvement to the App Hub. Recently I gave one of the new features, private beta testing, a spin. The process is actually easier than I thought it would be. There are a few things to keep in mind though. In this post I will share a quick walkthrough for distributing your app through private beta-testing. Please pay attention to the remarks. Dutch readers might recognize the info in the post, I recently started as an editor at Dutch WP7 community and newswebsite where I published a similar article in Dutch

WP7 Review Reader: New marketplaces

Written by Tom Verhoeff. Posted in MSP, WP7

With the launch of the new App Hub Microsoft also opened up 19 new consumer markets for application submission. Developers running the Mango beta can already access the new marketplace and thus can leave reviews for applications. Therefore I updated the Review Reader with support for all new marketplaces. If you haven’t done so please make sure your applications are submitted to the new marketplaces, even if your app was set for worldwide distribution it requires manual action (see my blogpost on worldwide distribution). It’s also worthwile to note a few changes to the new App Hub that impact checking your reviews. Within the App Hub it is now possible to view reviews and average for one marketplace at a time. This is an improvement, but MS isn’t quite there yet when they want to provide easy and efficient access to reviews.  Compared to the App Hub my review reader still offers this extra functionality: – Overview of all marketplaces – No-nonsense interface – Excel/CSV export – A try at contacting the reviewers – Average ratings since last update I still hope Microsoft will improve this experience in a future update, in the meantime my tool will stay available for all WP7 devs out there. Please let me know if you have any feedback or feature suggestions. You can find me on Twitter.

Debugging App Hub exceptions using Fiddler

Written by Tom Verhoeff. Posted in MSP, WP7

A while ago the App Hub got updated with some great new features. Having returned from a little holiday yesterday I decided to give the private beta feature a shot for a new app I am working on. Unfortunately the App Hub kept giving me the useless “An error occured connecting to the server. Please try again later” exception. I tried all the obvious workarounds: waited a while, tried other browsers, cleared my cache, but with no success. As a last resort before contacting support I figured my favorite tool Fiddler might help. Since the App Hub is a silverlight app, that obviously runs locally, capturing the web traffic could give some extra insight. To my surprise Fiddler gave me all the information I needed. Obviously this is something the App Hub should have shown, since the info is right there, but for the time being I’ll show you how to figure it out for yourself using Fiddler.