[英]sqlite-net-pcl SqliteAsyncConnection.CreateTableAsync<T> throws System.MissingMethodException
I am trying to create a table using the latest version of sqlite-net-pcl nuget package我正在尝试使用最新版本的 sqlite-net-pcl nuget 包创建一个表
var db = new SQLiteAsyncConnection("data.db");
await db.CreateTableAsync<Site>();
The CreateTableAsync call throws the following exception: CreateTableAsync 调用引发以下异常:
System.MissingMethodException: 'Method not found: 'System.String SQLitePCL.raw.sqlite3_column_name(SQLitePCL.sqlite3_stmt, Int32)'.'
System.MissingMethodException: '方法未找到:'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.我尝试降级到 sqlite-net-pcl 包的最新稳定版本。
In my case the problem was Microsoft.AppCenter and Microsoft.Appcenter.Distribute.就我而言,问题是 Microsoft.AppCenter 和 Microsoft.Appcenter.Distribute。 Those packages bring in an incompatible SQLite version and downgrading/removing them solved the problem.
这些包带来了不兼容的 SQLite 版本,降级/删除它们解决了问题。
删除我项目中的app.config文件似乎已经解决了问题。
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.我解决了这个错误,方法是创建一个全新的解决方案并手动复制所有代码和模型,然后让 Visual Studio 从 Nuget 导入所有需要的引用。
Uninstalling, reinstalling or removing packages from Nuget in my old/previous solution/project did not help/work.在我的旧/以前的解决方案/项目中从 Nuget 卸载、重新安装或删除软件包没有帮助/工作。
Apparently lingering or conflicting references from previous Nuget packages is the problem so starting fresh is the only thing that worked for me.显然,来自以前的 Nuget 包的引用挥之不去或相互冲突是问题所在,因此重新开始是唯一对我有用的方法。
See this link as well:也可以看看这个链接:
similar StackOverFlow post for 'System.MissingMethodException: Method not found?' “System.MissingMethodException: Method not found?”的类似 StackOverFlow 帖子
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
.在安装
sqlite-net-pcl
(用于玩弄 SQLite)之后,我偶然发现了这个错误,之后我又安装了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.我的解决方案是卸载两个 NuGet 包并仅安装
Microsoft.Azure.Mobile.Client.SQLiteStore
安装适当的sqlite-net-pcl
版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.