我正在构建xamarin表单应用程序,我在我的项目中使用了包“ Microsoft.EntityFrameworkCore.Sqlite”,
当我在ios / ipad上运行应用程序时,出现以下错误:
The type initializer for 'Microsoft.EntityFrameworkCore.Query.ResultOperators.Internal.TrackingExpressionNode' threw an exception
在android上运行正常
答案 0 :(得分:1)
这很可能与链接程序删除仅通过反射访问的程序集有关。将[assembly: Preserve (typeof (System.Linq.Queryable), AllMembers = true)]
放在iOS项目的Main.cs文件中(名称空间上方)应该可以解决该问题。您可以在答案https://stackoverflow.com/a/57574016/7183682的链接中找到有关此行为的更多信息。