-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Workarounds for Xamarin.iOS app with EFCore 2.0 #597
Comments
Correct. I don't think Xamarin.iOS can handle the Assembly.Load() call. And binding directly to |
From @alexdrl on November 22, 2017 18:27 I use the SQLitePCLraw assembly that gets added as a transitive dependency, and call that Init method, the app works correctly. In the project assets json, the Xamarin.iOS SQLitePCLraw package gets restored correctly. |
We should probably document this on the Supported .NET Implementations page or thereabouts. |
From @alexdrl on November 22, 2017 18:31 The documentation already stated that there are problems in Xamarin.iOS but there is no page that describes this (or other) workarounds. |
Worth noting here, with respect to the Entity Framework Core 2.1 release, and the Visual Studio 15.7.3 releases of Xamarin.iOS and Xamarin.Android:
At present, the only known workaround for Xamarin mobile app developers wishing to use Entity Framework Core is to not upgrade to the 2.1 release. i.e. Stay on 2.0.3 until the underlying Xamarin platforms have addressed deficiencies related to the new |
@cwrea Thank you for mentioning this. I would've spent hours debugging that issue if I hadn't seen your comment first! Literally saved us hundreds of dollars! |
@dfoulk You're welcome. FWIW, since I posted that, there's hope that Visual Studio 15.8 Preview 3 may address these issues. See my comment from a couple of days ago at xamarin/xamarin-macios#4168 (comment) ... I haven't tried the preview myself, yet. Tied up in other project work at the moment. |
@cwrea very weird. I'm running ef core 2.1 on my android and native UWP and it works and builds fine (debug and release) , but I'm using Microsoft.Extentions.primitives version 2.0 |
@Pinox Do you have linking enabled? The oustanding Android issue is specific to having linking enabled. |
@cwrea In release mode I have "SDK Assemblies" and in debug mode "none". Edit |
Updated to current known issues and workarounds:
For Xamarin.Android, use package.config instead of PackageReference (dependent on System.Runtime.CompilerServices.Unsafe linked away in release leading to crashes android#1196).[assembly: Preserve (typeof (System.Linq.Queryable), AllMembers = true)]
(dependent on Xamarin requires linker hints to preserve APIs accessed via reflection efcore#10963) or using a LinkDescription.xml file.SQLitePCL.Batteries_V2.Init()
(see https://github.com/ericsink/SQLitePCL.raw/wiki/SQLitePCL.Batteries.Init).Good sample app link applying workarounds by @cwrea: https://github.com/cwrea/XamarinTodo/tree/master
Original Issue:
From @alexdrl on November 21, 2017 8:44
A Xamarin.iOS app with EFCore 2.0 needs a call to
If the call is not made, the app initialization throws this error message.
Like explained here
Steps to reproduce
Xamarin.iOS project working with EFCore 2.0. Solution with a common .NET Standard project which shares code between iOS and Android, using PackageReference.
Further technical details
EF Core version: 2.0.0
Database Provider: Microsoft.EntityFrameworkCore.Sqlite
Operating system: iOS
IDE: Visual Studio 15.4
Copied from original issue: dotnet/efcore#10361
The text was updated successfully, but these errors were encountered: