7

I am trying to create a table using the latest version of sqlite-net-pcl nuget package

var db = new SQLiteAsyncConnection("data.db");
await db.CreateTableAsync<Site>();

The CreateTableAsync call throws the following exception:

System.MissingMethodException: 'Method not found: 'System.String SQLitePCL.raw.sqlite3_column_name(SQLitePCL.sqlite3_stmt, Int32)'.'

Here is the Site class

public class Site
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }

    public String Name;
    public String PriceCssSelector;
    public String URLRegex;

    public Site()
    {
    }
}

I tried downgrading to the latest stable version of sqlite-net-pcl package.

3
  • Did you do a clean build? Commented Sep 1, 2019 at 9:55
  • @jdweng Yes. When I downgrade the exception changes to FileLoadException: Could not load file or assembly 'SQLitePCLRaw.batteries_v2, Version=1.1.11.121, Culture=neutral, PublicKeyToken=8226ea5df37bcae9' or one of its dependencies. Commented Sep 1, 2019 at 9:57
  • 1
    I suspect the version is wrong. For testing create a simple new project just adding the sqllite library and see if you get the same error. You can then edit your .proj file and copy the version number from the test project .proj file. This usually works. Commented Sep 1, 2019 at 10:15

4 Answers 4

6

In my case the problem was Microsoft.AppCenter and Microsoft.Appcenter.Distribute. Those packages bring in an incompatible SQLite version and downgrading/removing them solved the problem.

Sign up to request clarification or add additional context in comments.

Comments

0

Deleting the app.config file in my project seems to have solved the problem.

Comments

0

I resolved this error, by creating a fresh new solution and manually copying over all the code & models, then let Visual Studio import all the needed references from Nuget.

Uninstalling, reinstalling or removing packages from Nuget in my old/previous solution/project did not help/work.

Apparently lingering or conflicting references from previous Nuget packages is the problem so starting fresh is the only thing that worked for me.

See this link as well:

similar StackOverFlow post for 'System.MissingMethodException: Method not found?'

Comments

0

I have stumbled across this error after installing sqlite-net-pcl (for toying with SQLite) and after that I have installed Microsoft.Azure.Mobile.Client.SQLiteStore.

My solution was to uninstall both NuGet packages and install Microsoft.Azure.Mobile.Client.SQLiteStore only which installed the appropriate sqlite-net-pcl version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.