Closed rowanmiller closed 2 years ago
@rowanmiller - any way to determine if this is something that is scheduled to be addressed in the near future or that will take a while to get to?
We don't have a schedule for this yet. We need to work with the Xamarin team to work out the best course of action.
Perhaps this is related: https://bugzilla.xamarin.com/show_bug.cgi?id=32180#c3 Comment 3 mentions a workaround.
Hello @rowanmiller
Faced the same issue on iOS platform. Do you have any resolution here or at least plan when it can be fixed?
Thanks, Artem.
This fix will be included in a future version of Mono... there aren't any specific dates around when the fix will ship yet.
Hi @rowanmiller I am still facing this issue on the iOS platform. Has the latest version of Mono having the fix been released yet? Thanks, Jeff
@rowanmiller / @divega
Hey Rowan, Diego,
Just wondering if there's any update on this re: Roadmap/Time-to-fix. The original bug over on the the xamarin bugzilla hasn't had any update in months. And the only mention of Xamarin on the EFCore Road map (https://github.com/aspnet/EntityFramework/wiki/Roadmap) is an acknowledgement that it doesn't work in all scenarios.
Just wondering if you can provide the community with a formal update, or simply acknowledge that this is far enough down the priority list, that anyone trying to build xamarin apps targetting IOS should consider using something else in the short term.
Cheers for all the efforts. Aside from this one bugbear, it looks great 👍
Hello everyone,
I just wanted to let you know, my application used to get that error but after updating Xamarin with the beta version, I can migrate, add and query data successfully. It seems like Mono 5.0 resolves the NotImplementedException issue but I didn't test all the EF features.
Tested with: `
Thanks @dominicboutin. That is consistent with what we have heard from the Xamarin team. I am glad to hear that you were able to test the fix. Do you know which exact version of Xamarin iOS you are using?
@divega Xamarin.IOS 10.10.0.19
Thanks for the info @dominicboutin. I've yet to test this. Are you using a Mac? I'm not sure how to update to the latest mono. I don't see an update on my Visual Studio 2017 yet. Anyone any idea?
@abdu292 according to these Xamarin release notes, Xamarin iOS 10.10 should be included in Visual Studio 2017 15.2 Preview 2.
Thank you @divega. I'll try that out. On vacation right now but I'll post an update as soon as I have access to my computer.
We are closing this issue as we believe the root cause has been removed in newer versions of Xamarin iOS. That said, support for Xamarin is still considered a work in progress. Please refer to the call for help at https://github.com/aspnet/EntityFramework/issues/4269#issuecomment-262601338, and create new issues for any problems you find.
Here's a tip for anybody else trying to get EF Core working on the latest Xamarin.iOS bits (10.10+):
While the blocker issue (NotImplementedException
during query) is gone, builds that target a physical iOS device, as opposed to the iOS simulator, will still experience runtime errors from EF Core, due to the Xamarin linker removing certain SDK types and methods that EF Core depends on but that haven't been directly referenced. (e.g. search the EF Core repo for instances of GetRuntimeMethod
.)
To fix, you need to tell the Xamarin linker not to exclude such things used by EF Core. In a sample I updated, the following did the trick to get it to run successfully on-device. I'll note that more complex usage of EF Core is likely to require a few more types and methods added to this:
<?xml version="1.0" encoding="utf-8" ?>
<linker>
<assembly fullname="mscorlib">
<type fullname="System.String">
<method name="Compare"></method>
<method name="CompareTo"></method>
<method name="ToUpper"></method>
<method name="ToLower"></method>
</type>
</assembly>
<assembly fullname="System.Core">
<type fullname="System.Linq.Expressions.Expression`1"></type>
<type fullname="System.Linq.Queryable"></type>
</assembly>
</linker>
@cwrea any idea what these other types are? I'm experiencing this and the file didn't seem to stop it. How do i determine which types are throwing the errors.
Message: System.TypeInitializationException: The type initializer for 'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions' threw an exception. ---> System.InvalidOperationException: Sequence contains no matching elementXamarin Exception Stack:
at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) <0x1033ac6d0 + 0x001cc> in <98d8ae0ba2c1456c96653359c4b1be27#40ebf054405c05b7662e2bda4a6f5577>:0
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.GetMethod (System.String name, System.Int32 parameterCount, System.Func`2[T,TResult] predicate) <0x103da5d58 + 0x000cf> in <5c7c882dab06409d85c27548a5ccf9d3#40ebf054405c05b7662e2bda4a6f5577>:0
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions..cctor () <0x103da5e4c + 0x00037> in <5c7c882dab06409d85c27548a5ccf9d3#40ebf054405c05b7662e2bda4a6f5577>:0
--- End of inner exception stack trace ---
at HELink.Services.DataContext.GetSh
@Kilowhisky Looking at your exception stack trace, the exception indirectly originates in Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions..cctor ()
which is the class constructor for the class. A class constructor is where the static fields of a class get initialized, and if there is no explicit static constructor, the compiler creates one.
Next, look at the source for that class here. Search for the word "static" and you will see all of the different static fields declared, with their initialization code inline. Notice that many of those call GetMethod()
.
I presume that you need to tell the linker about additional types referenced by those GetMethod()
calls, but you might need to attach the debugger to see which particular one is causing the exception you are seeing.
I know this thread is pretty old, but I'm trying to implement this code into my Xamarin.Forms iOS project in order to solve the issues with the deprecated WebKitUI
references. I'm finding that the linker is stripping out 'unused' code that then throws 'Unable to locate assembly'
errors, which seemed to be solved by adding in --linkskip
arguments into the -mtouch. With about 25 total arguments, I'd really like to incorporate this xml solution to cleaning it up, but I'm not sure about the execution. I tried following the advice of this SO post and adding an -mtouch argument that says
--xml=linkskip.xml
In this case, the code wouldn't compile: it yielded the error:
Could not process XML description: Failed to resolve assembly: 'Microsoft.Data.Sqlite.Core, Version...'
So instead I tried changing the -mtouch argument to say
--linkskip=linkskip.xml
In this case, my code compiles but doesn't seem to execute the linkskip arguments; it continues to throw 'assembly not found'
. What should I do here?
Reported by @econner20 - see https://github.com/aspnet/EntityFramework/issues/4269#issuecomment-263595495
I am having an issue with iOS. I used the example models and context from the example @polkduran provided and was successful in getting EF to work with Android, UWP and a Winforms target. However when I run the same Xamarin project/NETStandard assembly the iOS target is throwing the following exception: Unhandled Exception: System.NotImplementedException: Interpreter of ref types when trying to execute the following: