Inneractive Ads cause a lot of App crashes (Windows Phone)

5

I use InnerActive as my default Ad provide for my Windows Phone apps. I being using it since June 2013 and on my end of year analysis I realized InnerActive ads are my main source of my app crashes. The worst part is, it's code don't I don't have any control over. I already placed a "try catch" around every operation that requests Inneractive Ads.

Does anyone have any idea how can I resolve this issue?

Where is the code I use to request the Ads:

private void LoadInnerActiveAds()
{
    try
    {
        if (DeviceNetworkInformation.IsNetworkAvailable)
        {
            // Watch location
            if (_allowAdLocationTracker)
            {
                IaLocationClass iaLocation = new IaLocationClass();
                iaLocation.Done += new EventHandler<IaLocationEventArgs>(InnerActiveLocation_Done);
                iaLocation.StartWatchLocation();
            }

            optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
            //optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Gender, "m");
            optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Ad_Alignment, InneractiveAd.IaAdAlignment.CENTER.ToString());
            optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "480");
            optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "80");
        }

        //Show Add Banner. Remarks: pay attention to use Application Id from NAX
        //naxAd.Childred.Count()==0 => just to add one banner control on a page. Without this, code would add as many banners as you navigate to page where banner is placed
        if (optionalParams != null && AdsUIContainer.Children.Count == 0)
        {
            InneractiveAd iaBanner = new InneractiveAd(AdsAppId, InneractiveAd.IaAdType.IaAdType_Banner, 30, optionalParams);
            iaBanner.AdFailed += new InneractiveAd.IaAdFailed(InneractiveAd_AdFailed);

            Deployment.Current.Dispatcher.BeginInvoke(() => { UpdateUI(iaBanner); });
        }
    }
    catch (Exception ex)
    {
        InneractiveAd_AdFailed(ex);
    }
}

This stacktrace might help, but keep in mind this is code I don't control.

Frame    Image                Function                                                               Offset        
0        system_xml_ni        System.Xml.XmlTextReaderImpl.Throw                                     0x00000036    
1        system_xml_ni        System.Xml.XmlTextReaderImpl.ParseDocumentContent                      0x00000438    
2        system_xml_ni        System.Xml.XmlTextReaderImpl.Read                                      0x00000036    
3        system_xml_ni        System.Xml.XmlReader.ReadToFollowing                                   0x0000003c    
4        inneractive_ad_ni    Inneractive.Ad.InneractiveAdControl.ParseCPDXml                        0x0000007c    
5        inneractive_ad_ni    Inneractive.Ad.InneractiveAdControl.webClient_UploadStringCompleted    0x000000aa    
6        system_net_ni        System.Net.WebClient.OnUploadStringCompleted                           0x00000010    
7        system_net_ni        System.Net.WebClient.UploadStringOperationCompleted                    0x00000034

Solution:

Following Soonts suggestion, this is what I came up with:

In App.xaml.cs file locate "Application_UnhandledException" method and replace it with:

// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
    if (e.ExceptionObject.StackTrace.Contains("Inneractive.Ad.InneractiveAdControl"))
    {
        // Recover from the error
        e.Handled = true;
        return;
    }

    if (Debugger.IsAttached)
    {
        // An unhandled exception has occurred; break into the debugger
        Debugger.Break();
    }
}

Please let me know if you find better alternatives.

windows-phone-7
windows-phone-8
windows-phone
ads
asked on Stack Overflow Jan 21, 2014 by John Louros • edited Jan 25, 2014 by John Louros

1 Answer

1

First, contact InnerActive telling them to fix their software. It's their responsibility.

Meanwhile, if you know how to reproduce the problem, you can try following. Subscribe for all unhandled exceptions (start with Application.UnhandledException, also there're AppDomain.UnhandledException and TaskScheduler.UnobservedTaskException), in the handler search for “Inneractive.Ad.InneractiveAdControl” in the Exception.StackTrace, if found — ignore the exception, and optionally hide or reload the inneractive banner.

answered on Stack Overflow Jan 22, 2014 by Soonts

User contributions licensed under CC BY-SA 3.0