iOS app, using a .NET standard library. And using EntityFramework for SQLite.
The iOS app calls a routine to add an entity into a table:
msg = new QTNC.NETStandard.Models.Message();
msg.Received = DateTime.Now.ToUniversalTime();
msg.Created = DateTime.Parse(messageReceived["Created"]);
msg.Body = messageReceived["body"];
msg.HtmlBody = messageReceived["HtmlBody"];
msg.Title = messageReceived["title"];
msg.ProductName = messageReceived["ProductName"];
msg.TextColor = messageReceived["TextColor"];
msg.BackgroundColor = messageReceived["BackgroundColor"];
msg.Id = Guid.Parse(messageReceived["Id"]);
msg.Read = DateTime.Now;
database.Messages.Add(msg);
database.SaveChangesAsync();
return msg;
And message is defined as:
public class Message
{
[Key]
public Guid Id { get; set; }
public string ProductName { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public DateTime Received { get; set; }
public DateTime Read { get; set; }
public DateTime Created { get; set; }
public string HtmlBody { get; set; }
public string TextColor { get; set; }
public string BackgroundColor { get; set; }
}
The error happens on the database.Messages.Add(msg);
Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_void__this___Guid_object_object_DateTime_object_object_DateTime_DateTime_object_object (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.
the Read property btw was nullable at first, and interestingly the error was almost the same but was referring to a DateTime then as well.
And BTW, the link mentioned in the error (https://developer.xamarin.com/guides/ios/advanced_topics/limitations/) does not exist....
And a question on the side:
msg.Received = DateTime.Now.ToUniversalTime();
msg.Created = DateTime.Parse(messageReceived["Created"]);
messageReceived["Created"] is a string that contains a UTC time ,
but if I look at the value of msg.Created it shows me that value in localtime, why? (msg.Received shows the UTC time)