-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS cannot save Entity models with Nullable Guid (Guid?) property types (among others) using EF Core 2.1.2. #4749
Comments
We have this problem too in our app. @cfdelaune do you have a workaround for this until it's fixed? |
Unfortunately, no. I have been fighting with this problem for months. Until VS 2017 15.7.6, I could not even compile, so I am just now able to identify the specific problem. |
The workaround is here! https://github.com/ysmoradi/EfCoreiOSIssue/ |
@rolfbjarne can you please provide more information about what specific limitation in Xamarin iOS this is hitting? Also, any chance this can be re-prioritized? We have been getting lots of feedback from Xamarin customers trying to use EF Core and we have been working through issues with several people in the Xamarin team, trying to get things to a place in which we can claim it is usable and a good experience. And it seems we are getting so close! But having something like this lingering in the "Future" milestone could cause a lot of pain. |
@divega I've used ef core in many xamarin based projects. I've experienced 3 pains. 1- Poor performance on android devices, 2- sqlite migrations limitations and this issue. You're generating code at runtime using lambda expressions (NewExpression + Compile), and this violates iOS limitations. You may not generate code at runtime in iOS apps. I think you've used that feature to improve overall performance in some scenarios. Xamarin iOS has some workarounds for code generations at runtime and not every code generation results into exception. But when you talk about generics (Nullable for example), you can encounter a problem far easier! |
Here is some extra information. I have been able to reproduce the bug with Xamarin.iOS 11.14.0.13 (373c313), which is the one used to report the issue. I have also tested the following environments: -Latests stable Wit a successful build which is successful when running the application on a device it crashes. -Beta channel Similar build success. -Alpha channel The build fails with an unrelated issue. -Xcode 10 branch Application also builds with no errors And like the others, app crashes. |
@ysmoradi I'm not sure which limitation this is hitting, it might just be a bug too. I'll have to forward this to the mono team for them to have a look at it. |
This issue was moved to mono/mono#10483 |
Steps to Reproduce
Download, extract, and load the sample solution in Visual Studio 15.8.1.
iOSEFCore212.zip
Build and run the project, targeting a physical iPhone device.
PLEASE NOTE: This project has been adapted from the sample provided by @cwrea for a preceding issue described here.
Expected Behavior
The project should build and run, writing some lines to debug output indicating that Entity Framework Core has created a database from the simple model included in the project, saved a few test records, and retrieved them.
Actual Behavior
The following exception is encountered when AddAsync() is called against the DbSet:
System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_void__this___int_byte_object_object_DateTime_Nullable1<DateTime>_Decimal_Guid_Nullable1<Guid>_Nullable1<int> (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information. occurred
If the model (TodoItem.cs) does not contain a property of type Guid?, the project works without issue. Note that DateTime?, int?, and bool? property types work, but a similar error will be encountered for the decimal? type. I have not tested any additional nullable types at this time.
This issue is similar to https://bugzilla.xamarin.com/show_bug.cgi?id=58424 and https://bugzilla.xamarin.com/show_bug.cgi?id=59184, both of which have been marked as RESOLVED FIXED. I have submitted this per the suggestion of @divega.
Environment
Build Logs
The project builds without issue.
Example Project (If Possible)
iOSEFCore212.zip
The text was updated successfully, but these errors were encountered: