Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin Forms iOS app crashes with FileNotFoundException; Android app works fine.

$
0
0

I have a Xamarin Forms app which runs perfectly fine under Android on both the emulator or my physical device. However, when I try and run the iOS project, it fails on startup when its setting up the SQLLite connection/configuration.
Its throwing a FileNotFoundException complaining about System.ComponentModel.DataAnnotations.

This is referenced in the portable class project (and set Copy Local to true) and the model class that has the Data annotations works fine on Android. Indeed, if i look in

<my app path>\<myapp>.iOS\bin\iPhoneSimulator\Debug

I can see System.ComponentModel.DataAnnotations.dll in there. But for some reason the app is crashing:

        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

Has anyone seen this behaviour before or have any idea how I can diagnose it?

Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>