Recently I had to privilege of completing my first Windows Phone 7 application and was looking for a great way to monetize my application which I planned to publish for free. After all it is nice to be able to freely develop applications and have them published but this costs money (my AppHub Subscription fee). Knowing that I’d also like my application to be available on several platforms I began to investigate the best option for me. This lead me to Ad Mob, iAds (iPhone, dare I say it no that we have WP7), and Microsoft Advertising (http://pubcenter.microsoft.com). Quickly it became obvious that of the three Ad Mob was the only one that would provide a way to publish on all mobile platforms. I then followed my instincts and created an account on Ad Mob, published my application and began to watch the activity. What I noticed was in two weeks I had 1 day with Ads that were served that actually brought in revenue ($0.47). Going in I did know that the Windows Phone 7 program at Ad Mob was (Beta) so this was not as disconcerting as it may seem.
As a part of my application I have a feature that will prompt the user to send me a message whenever the application encounters and unexpected error. This is a best practice I suggest for all mobile application developers! This feature has already paid off (while no developer wants their application to through errors, it happens so you need a plan to deal with it.) I have received a couple of emails with the same error:
System.SystemException: An unknown error has occurred. Error: 80020006. at Microsoft.Phone.Controls.NativeMethods.ValidateHResult(Int32 hr) at Microsoft.Phone.Controls.WebBrowserInterop.InvokeScript(String scriptName, String args) at Microsoft.Phone.Controls.WebBrowser.InvokeScript(String scriptName, String args) at Google.AdMob.Ads.WindowsPhone7.WPF.DisplayAdBase.<>c__DisplayClass36.<RunScripts>b__34() at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark) at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, StackCrawlMark& stackMark) at System.Reflection.MethodBase.Invoke(Object obj, Object parameters) at System.Delegate.DynamicInvokeOne(Object args) at System.MulticastDelegate.DynamicInvokeImpl(Object args) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority) at System.Windows.Threading.Dispatcher.OnInvoke(Object context) at System.Windows.Hosting.CallbackCookie.Invoke(Object args) at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam pParams, ScriptParam& pResult)
What you will notice is that the stack traces back to a call made to the Ad Mob control:
This is the culprit for crashing my application, this can cause an application in the fragile Mobile application world to crash and burn. I have contacted the Ad Mob folks about this error and I have not heard back from them in regards to a fix, or potential fix as yet. In the mean time I have updated my application “Stock Arbiter” to use the Microsoft PubCenter (http://pubcenter.microsoft.com) and to this date I have not received any more unhandled exception notices.