Export (0) Print
Expand All

Error Handling

Updated: March 23, 2014

Published: April 2, 2014

To use the error handling events, you must reference the Microsoft.Advertising.Mobile.dll assembly. By including the Microsoft.Advertising.Mobile assembly in your project, you will be able to reference the functionality of the AdErrorEventArgs class.

For more information about that assembly and the classes it contains, see Microsoft.Advertising.Mobile Namespace.

Platforms

Apps Targeting Windows Phone 8

Handling an AdControl error event follows the standard patterns and practices of the .NET framework. For an overview of event handling, see the topic How to: Raise and Consume Events.

To handle AdControl errors, you:

In XAML/Silverlight markup, you set the ErrorOccurred event to the value of your error handler delegate using an assignment. Here is an example that uses the name “OnAdError” for the error handling delegate.

ErrorOccurred = "OnAdError_ErrorOccurred"

Below is an example an error handling function named OnAdError_ErrorOccurred that handles the ErrorOccurred event (C#).

        private void OnAdError_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e) 
        { 
            Debug.WriteLine("AdControl error: " + e.Error.Message); 
        } 

Apps Targeting Windows Phone 7

For a code example showing the use of the AdErrorEventArgs class, see Integrating Ads into a Hybrid Silverlight/XNA App. For example apps that use the error handling code, see the Additional Samples Online.

Support and Feedback

Get product support or report a bug in the product by visiting the Windows Phone Dev Center support page (scroll down to the section "Microsoft Advertising support").

Send feedback about this documentation to adsfdbk@microsoft.com. There is no product support through this alias. Documentation feedback only.

Community Additions

ADD
Show:
© 2014 Microsoft