Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unhandled Exception“System.InvalidOperationException” in System.Windows.ni.dll(admob)

Discussion in 'Windows' started by yurilin1, Oct 30, 2013.

  1. yurilin1

    yurilin1

    Joined:
    May 22, 2013
    Posts:
    102
    while integrated Admob SDK

    Code (csharp):
    1.  public MainPage()
    2.         {
    3.             var bridge = new UnityBridge();
    4.             UnityApp.SetBridge(bridge);
    5.             InitializeComponent();
    6.             bridge.Control = DrawingSurfaceBackground;
    7.            
    8.  
    9.             bannerAd = new AdView
    10.             {
    11.                 Format = AdFormats.Banner,
    12.                 AdUnitID = admobid;
    13.             };
    14.             bannerAd.VerticalAlignment = VerticalAlignment.Bottom;
    15.             bannerAd.HorizontalAlignment = HorizontalAlignment.Right;
    16.  
    17.  
    18.  
    19.             bannerAd.ReceivedAd += OnAdReceived;
    20.             bannerAd.FailedToReceiveAd += OnFailedToReceiveAd;
    21.             bannerAd.DismissingOverlay += OnDismissingOverlay;
    22.    
    23.  
    24.             admobLayer.Children.Add(bannerAd);
    25.             AdRequest adRequest = new AdRequest();
    26.             //adRequest.ForceTesting = true;
    27.             bannerAd.LoadAd(adRequest);
    28.         }

    I looks works fine and show the banner(I use the android publish id because I can't find the wp8 column while create a new publish id)
    But After I submit the project to the store.
    Microft just rejected it. Because of the following reason


    I remove the codes of the admob part. This problem disappeared.
    But with the admob.
    The error happened in
    Code (csharp):
    1.         // Code to execute on Unhandled Exceptions
    2.         private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    3.         {
    4.             if (System.Diagnostics.Debugger.IsAttached)
    5.             {
    6.                 // An unhandled exception has occurred; break into the debugger
    7.                 System.Diagnostics.Debugger.Break();
    8.             }
    9.         }
    It seems like an admob sdk bug while calling phone music by side button while playing the game.
    Any one has idea to solve this problem?

    It will be so sad if Admob still can't be use.(Although now the sdk looks has only banner ads.(no smart banner also))
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Check the callstack where exactly it crashes. You might be able to fix it.
     
  3. yurilin1

    yurilin1

    Joined:
    May 22, 2013
    Posts:
    102
    The callback stack reads
    > GoogleAds.ExampleApps.InterstitialExample.DLL!GoogleAds.ExampleApps.InterstitialExample.App.Application_UnhandledException(object sender, System.Windows.ApplicationUnhandledExceptionEventArgs e) line 102 C#

    it looks like happened it the google admob dll so I have no idea to deal with it?

    :cool:It looks not a unity problem because the google example itself crashes while calling music in the program
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Look inside ApplicationUnhandledExceptionEventArgs e to find out where it really crashed. Application_UnhandledException merely captures exception before crashing the program, so you have a chance to investigate it.