locked
Type not found in cache: SQLite.Net.Interop.ISQLitePlatform when registering service in universall app

    Question

  • Dear all,

    I am building an universal app and face to a wierd issue while building my service in shared part and register them in a VIewmodelLocator using SimpleIOC.

    The Locator is defined as follow :

    public class ViewModelLocator
        {
            /// <summary>
            /// Initializes a new instance of the ViewModelLocator class.
            /// </summary>
             static ViewModelLocator()
            {
                ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
    
                if (ViewModelBase.IsInDesignModeStatic)
                {
                    // Create design time view services and models
                    //SimpleIoc.Default.Register<IDataService, DesignDataService>();
                    SimpleIoc.Default.Register<Services.SQLiteService>();
                    SimpleIoc.Default.Register<IAdressService, Services.AdressService>();
                    
                }
                else
                {
                    // Create run time view services and models
                    SimpleIoc.Default.Register<ISQLiteService, Services.SQLiteService>();
                    SimpleIoc.Default.Register<IAdressService, Services.AdressService>();
                    
                }
                
                SimpleIoc.Default.Register<MainViewModel>();
                
            }
    
            public MainViewModel Main
            {
                get
                {
                    return ServiceLocator.Current.GetInstance<MainViewModel>();
                }
            }
    
                }
    • MainVIewModel has a IAdressService constructor parameter
    • AddressService class implement IAdressService and has ISQLiteService has constructor parameter

    When the Main property is called to get the single Instance of MainViewModel, I get an exception message error of :

    "Type not found in cache: SQLite.Net.Interop.ISQLitePlatform "

    SQLite.Net.Interop.ISQLitePlatform is used internally to SQLite-NET library

    how can I do to avoid this problem or register also the SQLite.Net.Interop.ISQLitePlatform  ?

    thnaks for help

    regards

    Thursday, April 9, 2015 10:34 AM

Answers

  • This question may be better answered on a SQLite forum.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by Solatys Monday, April 13, 2015 7:53 AM
    Thursday, April 9, 2015 1:07 PM
    Moderator