Hi. I currently have some problems with SQLite and Xamarin.Forms. I formed the full question under StackOverflow but didn't get any answer yet. My hope is that someone already had the error and know how to resolve it.
The full question is under: (I cannot directly send links at the moment, therefore I only can send the question without direct link)
-> stackoverflow.com/questions/48600391/xamarin-forms-sqlite-code-first-add-element-to-an-foreign-element-with-list-of-t
But here also a short description:
-> Error while using db.SaveChanges()
-> Error only caused on real device. No problems while running in the simulator.
My only goal is to
1. Load element out of database (1. Hirarchy, no linked elements before (no referending elements), no problems with saving and loading)
2. Create new database object and link to 1. element (reference)
3. Save changes
This error is resulting out the following code lines:
var dbMainObject = db.MyMainObjects.Include("MySubObjects").SingleOrDefault(s => s.Id == myParameterGivenId);
var newlyGeneratedSubObject = new MySubObject()
{
MyMainObject = dbMainObject,
... // Other data set
};
db.MySubObjects.Add(newlyGeneratedSubObject);
dbMainObject.MySubObjects.Add(newlyGeneratedSubObject);
db.SaveChanges(); // Results error
Error:
Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_void_this__long_byte_object_DateTime_object_object_Guid_object_int (object,intptr,intptr,intptr)' while running in aot-only mode.
Have a nice day and thanks.