Unhandled Exception

Feb 25, 2014 at 8:43 AM
Hello,

A bit similar to this thread:
https://wp7adrotator.codeplex.com/workitem/2890

My app (I use WP8 SDK) starting to give me unhandled exception after I implemented AdRotator:

my code - on xml:
 <adRotator:AdRotatorControl x:Name="AdRotatorControl" 
                xmlns:adRotator="clr-namespace:AdRotator;assembly=AdRotator"
                Width="480" Height="80"
                    SettingsUrl="http://domain.com/ad_settings/wp8adsetting.xml"
                    DefaultAdType="None"
                    DefaultSettingsFileUri="/AppAssemblyName;component/defaultAdSettings.xml"
                    MobFoxAppId="xxxxxxxxxx"
                    PubCenterAdUnitId="xxxxxx"
                    PubCenterAppId="xxxxxx-xxx-xxx-xxxx-xxxxxxxx"
                    SmaatoPublisherId ="xxxxxx"
                    SmaatoAppId="xxxxx"
                    AdDuplexAppId="xxxxx"
                    SlidingAdDirection="Left"
                    SlidingAdDisplaySeconds="10"
                    SlidingAdHiddenSeconds="20" />
on cs file:
private void loadedHandler(object sender, RoutedEventArgs e)
{
            try
            {
                AdRotatorControl.Invalidate();
            }
            catch (Exception excp)
            {
                Debug.WriteLine("AdRotator failed to invalidate! exception="+excp.Message);
            }

...
}
the exception:
{System.ArgumentNullException: Value cannot be null.
   at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
   at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
   at System.Windows.PresentationFrameworkCollection`1.Add(T value)
   at AdRotator.AdRotatorControl.Invalidate(Boolean selectNextAdType)
   at AdRotator.AdRotatorControl.<Init>b__c()}
The difference is, I already changed the "LayoutRoot" to something else, but it still gives me exception.
Even if I use try-catch on AdRotatorControl.Invalidate(); - doesn't catch anything.

please tell me how to fix it.

thank you
Coordinator
Feb 25, 2014 at 8:56 AM
Have you referenced all the Ad providers, this is a limitation in the V1 project.
Or you can try the new V2 beta
Feb 25, 2014 at 9:16 AM
Darkside wrote:
Have you referenced all the Ad providers, this is a limitation in the V1 project.
Or you can try the new V2 beta
Do you mean in the remote setting file?
I will try it
Coordinator
Feb 25, 2014 at 9:50 AM
No in your project. Use "Add Reference" to link the Ad Provider's dll's to your project.
If you installed via NuGet you should have links to each in the readme