locked
How to Debug System.TypeLoadException in Windows Runtime Component? RRS feed

  • Question

  • hi everyone,
    i'm building windows store app with C#, and using extra native code libraries by wrapping them into windows runtime component.

    the problem is, i get System.TypeLoadException when i use any of the types defined within that component,. 
    the weird part is it was working fine, and all of the sudden this exception started to show, note that i did not change any thing in the component.

    if you know what might be causing this, or have any ideas about how to debug it please share you knowledge.
    your help will be most appreciated.
     

    AbdelRahman Salah.

    Saturday, August 17, 2013 1:49 PM

Answers

  • Do you bave any static initializers in your classes? Set the debug mode to "Mixed" in the project settings instead of "managed only", and step into from where you start creating the type.

    Also make sure that you have VCLibs referenced in your project.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Sunday, August 18, 2013 4:25 PM

All replies

  • Usually this happens if the dll isn't deployed but only the Winmd, or you have an issue with x64/x86/arm getting mixed up. Make sure it's in the .appx package that's being generated and it's the right type.

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Sunday, August 18, 2013 4:55 AM
  • thanks for the tip Morten, i'll check it up and come back to you.

    AbdelRahman Salah.

    Sunday, August 18, 2013 9:30 AM
  • Dear Morten,
    i'm sure that all my configurations are set along to x86, and both the .winmd & .dll files are deployed..
    during the initialization of any type defined within the inner exception is System.IO.FileNotFoundException

    what do you think ?

    AbdelRahman Salah.

    Sunday, August 18, 2013 3:50 PM
  • Do you bave any static initializers in your classes? Set the debug mode to "Mixed" in the project settings instead of "managed only", and step into from where you start creating the type.

    Also make sure that you have VCLibs referenced in your project.


    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Sunday, August 18, 2013 4:25 PM
  • Hi,

    Some colleagues are getting this same error when trying to deploy an app that has reference to a Runtime Component implemented outside of our app solution (.winmd is referenced browsing the file system). They have the VS 2013 update 4, I have VS 2013 update 3 and don't get the error running the same solution/app. And our RT component has static initializers. Any insight on how those initializers could cause the problem?

    PS: We already reference VCLibs.

    Thanks

    Monday, December 1, 2014 8:24 PM