locked
Could not find Windows Runtime type 'Microsoft.Advertising.MicrosoftAdvertising_XamlTypeInfo.XamlMetaDataProvider' RRS feed

  • Question

  • Hello,

    Today my app has stopped working, I can't open it anymore. I haven't updated my app, and it worked so I seriously don't understand what happened.

    When I started to debug the app I get the following error:

    An exception of type 'System.TypeLoadException' occurred in MyApp.exe but was not handled in user code

    Additional information: Could not find Windows Runtime type 'Microsoft.Advertising.MicrosoftAdvertising_XamlTypeInfo.XamlMetaDataProvider'.

    The program is stopping in this point:

    public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
            {
                if(_provider == null)
                {
                    _provider = new global::MyApp.MyApp_XamlTypeInfo.XamlTypeInfoProvider();
                }
                return _provider.GetXamlTypeByType(type);
            }

    I started to remove the ad mediation from my app, but this is a huge financial loss for me. And I already got a dozens of one stars :(

    I would be so glad if someone could help me!

    Thanks in advance, 

    Henrik

    PS: I'm using admediator v2.1.0




    • Edited by henrikbarna Friday, December 11, 2015 9:20 PM
    Friday, December 11, 2015 7:01 PM

Answers

  • If you are still having crashes locally, the quickest way to unblock your development is as follows.

    Install the below test app from the store. It will copy the correct files you need onto your PC. You can run it on your phone also.

    After you install it, build and deploy your app to ensure it works now.

    You can uninstall the app after if you like, its not required to keep.

    https://www.microsoft.com/store/apps/9nblggh63jtn

    thanks, and sorry for all this trouble.

    • Proposed as answer by Tom Hollander Thursday, December 17, 2015 6:56 AM
    • Marked as answer by henrikbarna Thursday, December 17, 2015 8:33 AM
    Wednesday, December 16, 2015 5:40 PM

All replies

  • Sorry Henrik I can't help but I can confirm I have exact the same problem!
    Friday, December 11, 2015 8:44 PM
  • Hi,

    I have exactly the same issue on my laptop but not on my other computer. When I launch the app from my laptop it crashes. So to launch on my laptop I removed Microsoft Advertising SDK for XAML reference from the project and I deploy on the store like this. So only Adduplex works for now until I find a solution. But to make your app working you can remove this reference. I think reinstalling Visual Studio 2015 can solved this issue but I'm not sure.

    Regards

    Manitra


    Saturday, December 12, 2015 11:38 AM
  • On the same laptop I sign in using a student or work account (office 365) with that account I have this problem. When I sign in with my Microsoft Account on the same laptop the app doesn't crash.

    The eventlog repored this:

    Faulting application name: Like Any Browser.exe, version: 1.0.0.0, time stamp: 0x55e687e9
    Faulting module name: Windows.UI.Xaml.dll, version: 10.0.10240.16548, time stamp: 0x5613361e
    Exception code: 0xc000027b
    Fault offset: 0x00692408
    Faulting process id: 0x1e10
    Faulting application start time: 0x01d1346176e41a03
    Faulting application path: C:\Users\mauri_89nzdp6\AppData\Local\DevelopmentFiles\iTeeZZZ.FreeAppforWhatsAppWebVS.Debug_x86.dev\Like Any Browser.exe
    Faulting module path: C:\Windows\System32\Windows.UI.Xaml.dll
    Report Id: 3cfe0fab-ef55-475b-8928-1a496626da0b
    Faulting package full name: iTeeZZZ.FreeAppforWhatsAppWeb_2.0.0.0_x86__s5a4bpb2whts2
    Faulting package-relative application ID: App

    I haven't installed Visual Studio on this laptop but since I found out these crashes and on my dev machine it didn't crash. I installed the remote debugger so I could find out what the problem is.

    Saturday, December 12, 2015 12:14 PM
    • Edited by Dev3000 Saturday, December 12, 2015 2:15 PM
    Saturday, December 12, 2015 2:13 PM
  • same problem here!!!

    it's affecting my project under development, but the apps already in the store are unaffected.

    hope we find out what's going on soon!


    cypripri

    Saturday, December 12, 2015 4:46 PM
  • Same problem. Started to happened two days. App crash when first starting with error

    Exception thrown: 'System.TypeLoadException' in App2.exe
    Additional information: Could not find Windows Runtime type 'Microsoft.Advertising.MicrosoftAdvertising_XamlTypeInfo.XamlMetaDataProvider'.

    Saturday, December 12, 2015 5:45 PM
  • Hi,

    When using Ad Mediator, you should handle unhandled exceptions from ad networks to avoid app crashes due to Ad Mediator, copy and paste the code sample below to your App.xaml.cs file:

    // In App.xaml.cs file, register with the UnhandledException event handler.
    UnhandledException += Application_UnhandledException;
    
    // Code to execute on unhandled exceptions
    private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        if (e != null)
       {
           Exception exception = e.ExceptionObject;
           if ((exception is XmlException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("INNERACTIVE"))
           {
               Debug.WriteLine("Handled Inneractive exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if (exception is NullReferenceException && exception.ToString().ToUpper().Contains("SOMA"))
           {
               Debug.WriteLine("Handled Smaato null reference exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if ((exception is System.IO.IOException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("GOOGLE"))
          {
              Debug.WriteLine("Handled Google exception {0}", exception);
              e.Handled = true;
              return;
           }
           else if (exception is ObjectDisposedException && exception.ToString().ToUpper().Contains("MOBFOX"))
           {
               Debug.WriteLine("Handled Mobfox exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if ((exception is NullReferenceException || exception is XamlParseException) && exception.ToString().ToUpper().Contains("MICROSOFT.ADVERTISING"))
           {
               Debug.WriteLine("Handled Microsoft.Advertising exception {0}", exception);
               e.Handled = true;
               return;
           }
                  
       }
    // APP SPECIFIC HANDLING HERE
    
    if (Debugger.IsAttached)
       {
           // An unhandled exception has occurred; break into the debugger
           Debugger.Break();
       }
       //e.Handled = true;
    }


    More details you can refer at this page.

    Hope this helps!


    • Edited by Lion Pham Saturday, December 12, 2015 6:51 PM
    Saturday, December 12, 2015 6:45 PM
  • Implementing this code did not prevent the apps from crashing for me.

    The same error is still occuring.

    Saturday, December 12, 2015 7:49 PM
  • Hi,

    I have the exact same issue with all my apps that are using AdMediator (2.2.0). I think this started to occur after last Windows OS update (on both mobile and desktop). I'm debuging my apps and apparently there's no way to handle this crash :( Any help would be very much appreciated.

    Regards,

    Ernesto

     


    Saturday, December 12, 2015 8:10 PM
  • Please check my new code. The new code is highlighted in bold:

    // In App.xaml.cs file, register with the UnhandledException event handler.
    UnhandledException += Application_UnhandledException;
    
    // Code to execute on unhandled exceptions
    private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        if (e != null)
       {
           Exception exception = e.ExceptionObject;
           if ((exception is XmlException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("INNERACTIVE"))
           {
               Debug.WriteLine("Handled Inneractive exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if (exception is NullReferenceException && exception.ToString().ToUpper().Contains("SOMA"))
           {
               Debug.WriteLine("Handled Smaato null reference exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if ((exception is System.IO.IOException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("GOOGLE"))
          {
              Debug.WriteLine("Handled Google exception {0}", exception);
              e.Handled = true;
              return;
           }
           else if (exception is ObjectDisposedException && exception.ToString().ToUpper().Contains("MOBFOX"))
           {
               Debug.WriteLine("Handled Mobfox exception {0}", exception);
               e.Handled = true;
               return;
           }
           else if ((exception is NullReferenceException || exception is XamlParseException || exception is TypeLoadException) && exception.ToString().ToUpper().Contains("MICROSOFT.ADVERTISING"))
           {
               Debug.WriteLine("Handled Microsoft.Advertising exception {0}", exception);
               e.Handled = true;
               return;
           }
                  
       }
    // APP SPECIFIC HANDLING HERE
    
    if (Debugger.IsAttached)
       {
           // An unhandled exception has occurred; break into the debugger
           Debugger.Break();
       }
       //e.Handled = true;
    }

    Saturday, December 12, 2015 8:52 PM
  • I don't think this Exception Handling will help at all here - I already tried out following code without sucess. 

    // In App.xaml.cs file, register with the UnhandledException event handler.
    UnhandledException += Application_UnhandledException;
    
    // Code to execute on unhandled exceptions
    private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        if (e != null)
       {
           e.Handled = true;
    } }

    Saturday, December 12, 2015 9:12 PM
  • Yes, exception handling is no fix.  Same problem. Tim, I described more in your thread.

    Here's more information.  It happens in some, but not all of my C# programs.  It doesn't happen on my one C++ based program.  I noticed if no ads are served it won't crash the C# programs.

    Sunday, December 13, 2015 4:32 AM
  • same prob here.

    exception handling does not solve anything.

    loosing money & users. thank you very much MSFT!

    Sunday, December 13, 2015 11:09 AM
  • Did anyone create a support ticket on this? We need a way to reproduce this. I lost my scenario because the machine that I used to reproduce the problem and succeeded. Got updated with the 1511 update. Which fixed it.

    And we don't want that to be the answer to our problems do we?

    I saw someone reply on one of the threads, he deployed a couple of machines in azure and 4 of them reproduced the problem. If I can find time this afternoon I will try that and create a support ticket.

    Sunday, December 13, 2015 12:08 PM
  • lost my scenario because the machine that I used to reproduce the problem and succeeded. Got updated with the 1511 update. Which fixed it.

    that's funny. i just became aware of the AdMediator bug after upgrading to 1511 on 2 machines.  On the 1511 machines all my apps with AdMediator crashes with error above.  on another machine without 1511 update they still work.

    • Edited by wolfSYS Sunday, December 13, 2015 12:37 PM
    Sunday, December 13, 2015 12:36 PM
  • Ok that will make it totally random.
    So to the end-user this is a completely random scenario.
    Sunday, December 13, 2015 4:15 PM
  • Ok that will make it totally random.
    So to the end-user this is a completely random scenario.

    I've been unable to reproduce it.  One App was temporarily fixed by switching from AdMediator to AdControl. I sent the update to the store and it worked for a while.  Then it started crashing on startup again.  This was with UI:AdControl.  It is very random.  Ad specific?

    • Edited by DMHA Apps Sunday, December 13, 2015 5:51 PM added "ad specific?"
    Sunday, December 13, 2015 5:32 PM
  • I have the same problem and I m using admediator 2.0.2, my app crash on every devices...

    Edit:

    I "solved" the problem with a try catch in c# code, the ad médiation doesn't work but my app doesn't crash...



    • Edited by Sami54 Monday, December 14, 2015 9:55 AM
    Sunday, December 13, 2015 10:11 PM
  • Can you tell us where exactly you put your try and catch block? I tried the unhandled_exceptions approach and it did not work.
    Monday, December 14, 2015 12:19 PM
  • I put my try catch in the page loaded method
    Monday, December 14, 2015 12:28 PM
  • Could you please post a sample code of your solution?

    It would be nice to implement it in all apps because the apps are not crashing anymore. And as soon Microsoft figured out what they did do wrong - I guess something is wrong on their server side - the ads would work again.

    Monday, December 14, 2015 1:38 PM
  • ok, this a code sample:

    C# :

    using Microsoft.AdMediator.Universal; AdMediatorControl ad = new AdMediatorControl(); private void Page_Loaded(object sender, RoutedEventArgs e) { try { ad.Name = "AdMediator..."; ad.Id = "...."; ad.Width = 160; ad.Height = 600; ad. ... ad.Resume(); } catch(Exception eX) { Debug.WriteLine(eX.Message); }

    }

    XAML :

    <Page

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:local="using:..."

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    xmlns:Universal="using:Microsoft.AdMediator.Universal"

    x:Class="....MainPage"

    mc:Ignorable="d"Loaded="Page_Loaded" >

    ...

    I hope it will help you

    Monday, December 14, 2015 2:22 PM
  • Just a word of warning - if you are using the SuspensionManager class to manage app resume and suspend events, then you may still experience problems (and ones that can't easily be trapped by try/catch).

    As far as I can see, the problem is that, during app initialisation, the SuspensionManager will query various type-discovery interfaces on the AdMediator DLL, and this will result in a COM Exception.  Even if you do catch it in your app initialisation code, it will still break the SuspensionManager, meaning that suspend/resume will not work right.

    I have updated my apps in the Store, by removing all references to Microsoft's advertising libararies.  I rather doubt whether I will every put these references back - perhaps there is some other ad mediation solution that does not cause so much chaos and disaster!  Those 1-star reviews are just streaming in!

    And no response yet, on my support ticket.  Sigh.


    Jim Chapman

    Monday, December 14, 2015 3:41 PM
  • Yesterday I did that try catch for my app and now, with the new version of my app I have not that crash and I have no problems with suspend/resume.


    • Edited by Sami54 Monday, December 14, 2015 4:16 PM
    Monday, December 14, 2015 4:07 PM
  • But do you use SuspensionManager?  Quite possibly you do not (it is a standard Microsoft component, but the App.cs boilerplate code does not include it for every project type, and maybe it is not in your project).

    Jim Chapman

    Monday, December 14, 2015 4:22 PM
  • No I don't use SuspensionManager
    Monday, December 14, 2015 4:59 PM
  • We pushed a fix last night for the Ads SDK crashing. If you are still seeing the issue, try uninstalling and reinstalling your application.

    Tuesday, December 15, 2015 9:32 PM
  • I tried to reinstall the app, the sdk, cleaned the project but none of them helped still seeing the error.
    Tuesday, December 15, 2015 10:05 PM
  • my app in store works fine now :)

    Wednesday, December 16, 2015 5:14 AM
  • If you are still having crashes locally, the quickest way to unblock your development is as follows.

    Install the below test app from the store. It will copy the correct files you need onto your PC. You can run it on your phone also.

    After you install it, build and deploy your app to ensure it works now.

    You can uninstall the app after if you like, its not required to keep.

    https://www.microsoft.com/store/apps/9nblggh63jtn

    thanks, and sorry for all this trouble.

    • Proposed as answer by Tom Hollander Thursday, December 17, 2015 6:56 AM
    • Marked as answer by henrikbarna Thursday, December 17, 2015 8:33 AM
    Wednesday, December 16, 2015 5:40 PM
  • So what was the fix for this ??

    I currently experiencing this very same problem with the latest AdControl from Microsoft.Services.Store.SDK.

    I don't see a fix in this thread, how can there be a solution?

    I get the following error:

    Exception thrown: 'System.TypeLoadException' in TuneIn.exe

     

    Additional information: Requested Windows Runtime type 'Microsoft.Advertising.MicrosoftAdvertising_XamlTypeInfo.XamlMetaDataProvider' is not registered.

    And this only happens on specific machines, we don't know why.

    • Edited by maximus37 Friday, December 9, 2016 7:49 PM
    Friday, December 9, 2016 7:48 PM