我有一个Xamarin Forms应用程序,在Android模拟器或我的物理设备上运行得非常好。但是,当我尝试运行iOS项目时,它在设置SQLLite
连接/配置时启动失败。
它引发FileNotFoundException
抱怨System.ComponentModel.DataAnnotations
。
这在可移植类项目中引用(并将Copy Local设置为true),并且具有Data annotations的模型类在Android上正常工作。的确,如果我查看
<my app path>\<myapp>.iOS\bin\iPhoneSimulator\Debug
我可以在那里看到System.ComponentModel.DataAnnotations.dll。但由于某种原因,应用程序崩溃了:
Unhandled Exception:
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesDataInternal (System.Reflection.ICustomAttributeProvider)
at System.MonoCustomAttrs.GetCustomAttributesData (System.Reflection.ICustomAttributeProvider obj) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:303
at System.Reflection.CustomAttributeData.GetCustomAttributes (System.Reflection.MemberInfo target) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/CustomAttributeData.cs:119
at System.Reflection.MonoProperty.GetCustomAttributesData () [0
x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:463
at System.Reflection.MemberInfo.get_CustomAttributes () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/referencesource/mscorlib/system/reflection/memberinfo.cs:51
at SQLite.TableMapping..ctor (System.Type type, SQLite.CreateFlags createFlags) [0x00100] in <9b4aaa86123841b8bec74a2ddde70f09>:0
at SQLite.SQLiteConnection.GetMapping (System.Type type, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
at SQLite.SQLiteConnection.CreateTable (System.Type ty, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
at SQLite.SQLiteAsyncConnection+<>c__DisplayClass11_0.<CreateTablesAsync>b__0 () [0x0002b] in <9b4aaa86123841b8bec74a2ddde70f09>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Version
之前有没有人见过这种行为或者有任何想法可以诊断它?
由于