Derek Lakin

AdException using Microsoft Advertising SDK

When you’re developing Windows Phone apps using the Microsoft Advertising SDK, you may not see any ads when you were expecting to. This is likely to be accompanied by the following message in the Output window in Visual Studio:

An exception of type 'Microsoft.Advertising.Shared.AdException' occurred in Microsoft.Advertising.Mobile.DLL and wasn't handled before a managed/native boundary.

There’s a couple of things to check here:

  1. Make sure you have IDCAPPHONE_DIALER in your capabilities (I have no idea why the Ad SDK needs the capability!).
  2. If you’re running in the emulator and using actual Application and Ad Unit Ids, you won’t see any ads. You should use "testclient" and "Image48080" for testing (NOTE: the casing is important).
  3. If all else fails, add an event handler for the ErrorOccurred event on the AdControl to see what’s happening:

var ads = new AdControl { "test_client", "Image480_80", true };
ads.ErrorOccurred += (o, e) => { System.Diagnostics.Debug.WriteLine(e); };

I’m sure this is fairly well covered elsewhere, so it’s more of a "note-to-self".

ads windowsphone wpdev