adrotator crashes if pubcenter crashes

May 15, 2012 at 6:58 AM

I am testing this control to see if it will be a good stable solution and have notice if i navigate in my silverlight app to a new page and return to the page with the control and navigate one page back the control stops working

it shows this:

'UI Task' (Managed): Loaded 'Microsoft.Xna.Framework.dll'
The thread '<No Name>' (0x1af202de) has exited with code 0 (0x0).

 

it always seems to happen after Microsoft.Xna.Framework.dll is loaded.

i have also tried to add pubcenter adcontrol for xna and still crashing.

May 15, 2012 at 9:54 AM

What release of AdRototator are you using and what version of PubCenter have you used?

Does the sample application do the same thing on your machine and have you tried / looked at the "Starter" samples from XNA-UK here http://bit.ly/wZMGT3

May 15, 2012 at 10:18 AM

I just downloaded it today so it should be the latest version of adrotator and im jusing the latest version of pubcenter as well. My app is a silverlight app that is basically a list app that contains data in an xml. When loading the initial list it loads the xna.framework.dll. i have targeted that to be the cause of the control crashing. Im still a newbie at all this stuff but it seems like       <Capability Name="ID_CAP_MEDIALIB" /> initializes the xna.framework.dll in my app. i have checked against my paid app and it never loads the xna.framework.dll. but right now if you launch my app  you go to a main page then select a category that has the list. When you go to that list you can go forward and return to the list and the control still displays but as soon as you go to the main page again it crashes the control when you relaunch the list. I have racked my brain on what is going on but seem to hit a wall. Thank you for your response

May 15, 2012 at 4:21 PM

The only reason PubCenter would crash is if the old issue has re-surfaced, in which case ensure you are calling "AdRotator.Dispose" in your "Navigating From" method and "AdRotator.Invalidate()" in your "Navigating To" (see the example for more detail)

In any case PubCenter shouldn't cause your app to crash, going to put a little helper routine in the Example (which you can copy) to dump the exception to isolated storage if you app crashes and it'll display on next start.

May 15, 2012 at 8:39 PM
Edited May 15, 2012 at 8:41 PM

i have included those originally and they are still in my code

 

              protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
                AdRotatorControl.Invalidate();
             base.OnNavigatedTo(e);
        }

              protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
              {
                  AdRotatorControl.Dispose();
                  base.OnNavigatedFrom(e);
              }

 

i am also using ad sdk 6.1.320.0 because if i use the older version the whole page crashes and im using v1.1 of the adrotator control.

i have been playing with the example and adding bits and pieces of my code and i think it comes down to what was posted in another discussion about navigation. lets say you have 3 pages. page 1 = list, page 2 = adcontrol, page 3 = just data. so if you go to page 2 then jump to page 3 and just jump between the two the control will work on page 2 still. If you go from page 2 to page 1 then back to page 2 the control never loads again. i was able to replicate it in the example by adding a new page and pointing to that page on app start up. then added a button control that navigated to the mainpage. all works fine till i return the the initial page and try to navigate back to the mainpage of the example where mainpage is the 2nd page of the app.

May 16, 2012 at 9:47 AM

In tests I cannot replicate the issue with partner Ads or a remote ad but I do have an issue with the In house Ads in Silverlight where initialising the page twice causes an issue.

 

Note in your code example above you should check that the AdRotator control is initialised BEFORE you call invalidate like this

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
	if (AdRotatorControl.IsInitilised)
	{
		AdRotatorControl.Invalidate();
	} 
	base.OnNavigatedTo(e);
}

Will continue to test further.  If you extend the Example provided with AdRotator do you encounter the same issue?

May 16, 2012 at 5:40 PM

yes i have extended the example and what happens is if you go a page back that is further than the page that has the control in it then it will never re initialize when you launch the page with the control again. that is what i experienced when i extended the example. Im not using in house ads but i get this issue just using pubcenter and smaato.

May 16, 2012 at 6:19 PM

I just noticed you uploaded a new version. I got it set up and now its a little better but same problem. so let say 3 pages again. 1st page is your main page with no ads. i would navigate to page 2 where the control is and it starts then i navigate to page 3 and then return to page 2 the control still works. now if i return to page 1 and then navigate back to page 2 the control wont start (in the extended example in the log box it says "Control tested before loaded" but no buttons were pushed just the page launched.) but if i go to page 3 again and return to page 2 it starts up again. so the problem is only when navigating a page behind the control and trying to relaunch the page with the control again. i have uploaded the updated sample so you can see what im talking about. Extended Example with the Issue

 

May 16, 2012 at 6:45 PM
Edited May 16, 2012 at 6:49 PM

i solved the issue just need to add

 

              private void OnPageLoaded(object sender, RoutedEventArgs e)
              {
                  if (AdRotatorControl.IsInitilised)
                  {
                      AdRotatorControl.Invalidate();
                  }
              }

so when the page is reloaded it restarts the control. with out placing this in the pageapplication event it will not load as described above.

thank you for your awesome control. you have solved my issues with just using crappy pubcenter

May 17, 2012 at 11:08 AM

Thanks for the Tip, it shouldn't matter if you put Invalidate in the OnLoaded or OnNavigated to unless PubCenter has done something off the bat (not the first time)

Will add that to the updated docs.

 

Glad you're up and working now.

Jun 5, 2012 at 5:13 AM

Here is more information on this thread, in case it helps anyone out.

I have a pretty simple two-page app.  Both pages have separate instances of AdRotator in them.  The first page doesn't have any issues with ads.  Tap a button in the ApplicationBar to go to the second page, and the ad wouldn't show up.  From there, tap the Start button and then the Back button, and the ad would show up.  I had the page set up with the Invalidate() call in the OnNavigatedTo() method.

After reading this thread, I switched the Invalidate() to be in the Page's Loaded event.  That changed the behavior.  Now, when tapping the ApplicationBar button to go to the second page, the ad shows up.  However, when tapping Start and then Back, the ad disappears.

So I have Invalidate() in both methods, and I don't have any problems with ads displaying on the second page.  Perhaps there's a single place I can put it that will work better.  That's a puzzle for another night.

Aug 1, 2012 at 8:58 PM

I also had this issue and it was solved by adding the suggested line.

  if (AdRotatorControl.IsInitilised)
                  {
                      AdRotatorControl.Invalidate();
                  }

Thanks for a good solution and a very good tool!

Aug 9, 2012 at 11:05 AM

Bit nitpicky, but "IsInitilised" has a spelling mistake, it should be "IsInitialised"...

:)