Fix – WP7 AdControl Disappears after Upgrade to 7.1

Last night I cut over a few WP7 7.0 applications using the AdControl to 7.1 (Mango). In the process I lost the AdControl on all the application pages. No error, not complaint just an empty place where the AdControl should have been.  If I was paying close attention I could see a brief flicker of the outline of the AdControl as though it was loading.

If you search the Internet you will find a few posts, most attempts to resolve this issue by explicitly setting the Test flag to false but in my case this was not the solution.  The solution was clear to me once I realized the AdControl has an ErrorOccurred event. Binding an event handler to this event made the debug very easy.

In all of my upgrade instances the applications required additional device Capability elements added to the WMAppManifest.xml file.  In all of the applications I converted from 7.0 to 7.1 the defined Capabilities  were :

ID_CAP_NETWORKING
ID_CAP_WEBBROWSERCOMPONENT

Note: This is not the default list of capabilities for the 7.0 projects but we remove those that are not needed before we deploy to the Marketplace

The 7.1 version of the Ad control also required the following device capabilities to be included in the WMAppManifest.xml file:

ID_CAP_PHONEDIALER
ID_CAP_IDENTITY_USER
ID_CAP_MEDIALIB

Adding these three capabilities to the WMAppManifest.xml file fixed the AdControl issue.

The key take away from this issue is to know there is an ErrorOccurred event on the AdControl and that you should define an event handler to this event whenever you have an issue with the control. You will save yourself some dev cycles.

Leave a Reply