ArgumentException caused by default name of "LayoutRoot"


If adrotatorcontrol is in a virtualized container (ListBox), or in a container named "LayoutRoot", the adrotatorcontrol can and will crash the hosting application with the following exception:

Message: Value cannot be null.

Stack Trace: at System.Windows.PresentationFrameworkCollection1.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()

Sometimes this can be hard to reproduce, but after reproducing once you will crash the application constantly. This can be fixed by renaming the default container grid for the AdRotatorControl named "LayoutRoot" to something else. Also, you can catch this exception where the ad control is created and added to the control. This has caused about 700 crashes on our app and was only caught when in release mode on the store.
Closed Sep 27, 2013 at 7:01 PM by Darkside
LayoutRoot renamed to AdRotatorLayoutRoot in new version


Darkside wrote Jul 30, 2013 at 9:54 AM

A very interesting issue but I can see the sense of it. Granted the name hierarchy shouldn't interfere like that but yes I can see now cases where that could be an issue.

We shall add it to the backlog for the upcoming final release and also ensure it's included in the next V2 drop.

As a work around for now I'd suggest renaming the container that adrotator is placed in until we can package the next release

wrote Sep 27, 2013 at 7:01 PM