NullReferenceException when return from ad click

May 17, 2012 at 2:33 PM

I have followed all instructions and using the latest update 1.1 (released today).

When returning (tapping back) from an ad click from Adduplex everything is ok but when returning (tapping back) from clicking an AdMob ad my app closes and throws a NullReferenceException.


   at Google.AdMob.Ads.WindowsPhone7.Support.DownloadHelper.<>c__DisplayClass1.<Run>b__0(IAsyncResult AsyncResult)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)
   at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadPool.WorkItem.doWork(Object o)
   at System.Threading.Timer.ring()

I was using AdMob in my app previously with no issues.

I have managed to get my multipage app with adrotator to not throw the above exception by doing the following;

1. Do not use .Dispose at all

2. Put the .Invalidate in the Loaded event

I am not sure what issues will be caused by not calling .Dispose but it is the only way I could stop my app from crashing after returning from an AdMob click.

May 27, 2012 at 1:02 AM

I have worked out why the app was crashing on tapping an AdMob ad. I had left out ID_CAP_LOCATION from the WMAppManifest.

However I still can't use the .Despose method as no ad appears on the next page when I do.

May 28, 2012 at 9:49 AM

Sorry it's taken so long to reply.

The OnLoading Invoke and dispose was added in reaction to the issues with the original pubcenter ad issues as it was causing apps to crash.

You should be able to live without either of these if you are not using pubcenter, however pubcenter was updated recently and so this technique may not even be needed anymore.

My advice is to try using it without calling invalidate in "onNavigatedTo" or Dispose in "OnNavigatingFrom" and see how it goes, if in testing you have issue reintroduce them.  You can also query the current AdType and if it's AdMob then don't dispose.

AdMob has been a very funny control to get working and I hope they can being out an updated control sometime soon.