Efcore: Database connection via Entity Framework fails on iOS device in Release confiuration

Created on 16 Sep 2020  ·  10Comments  ·  Source: dotnet/efcore

Sample iOS application i downloaded from this repository constantly crashes on my iPhones (iOS versions from 13.4-13.7) in Release configuration. Everything is good, when I run it in Debug. There is a problem with connecting to a SQLite database using Entity Framework.

To Reproduce

  • Clone the repository
  • Build 'EFGetStarted.iOS' application in Release configuration
  • Deploy the application to an iPhone
  • Run the application
  • Application crashes

Additional context

Microsoft.Data.Sqlite version: 3.1.5 (the issue also appear after upgrading to 3.1.8)
Target framework: .NET Standard 2.0
Operating system: iOS 13.4-13.7

closed-question customer-reported

Most helpful comment

@bpitppg - checking in to let you know I did not forget about you. I'm running down a few loose ends here as to why you're still experiencing crashes. I should have an answer for you soon.

All 10 comments

/cc @JeremyLikness

While on an iOS device & in release mode the Xamarin.iOS interpreter needs to be on for EF to work properly. (More info on the Xam.iOS interpreter).

Updated the sample and PR'd it: https://github.com/dotnet/EntityFramework.Docs/pull/2666

I did what you proposed, @codemillmatt. However, it didn't work. The application still crashes

@bpitppg - checking in to let you know I did not forget about you. I'm running down a few loose ends here as to why you're still experiencing crashes. I should have an answer for you soon.

@bpitppg - the sample's been updated in this PR

You can ignore anything that deals with the interpreter.

Instead set the iOS linker to Don't Link for the device release configuration. (As per: http://docs.microsoft.com/xamarin/ios/deploy-test/linker)

Let me know if that works for you or not.

@codemillmatt Thanks, this has fixed our issue. (I'm working with @bpitppg)

Fixed per @lion92pl

@JeremyLikness I was just writing when you have closed this issue.
Unfortunately setting linker behavior to _Don't link_ causes app upload to App Store to fail.
As stated in Publishing Xamarin.iOS apps to the App Store:

Using the Don't Link option can cause Apple to reject the app due to the presence of non-public iOS APIs in Xamarin.iOS that would be linked out with the Link Framework SDKs only option

I have tried changing back to _Link framework SDK's only_ and adding _--linkskip System.Core_ to Additional mtouch arguments. And that is what fixed this for us. App is working fine and Apple has accepted this build.

The latest merge has the guidance you mentioned.

The latest merge has the guidance you mentioned.

I know, that from where I took this. But it still mentions setting linker behavior to Don't link as a second option. Might be worth adding comment, that this might cause Apple to reject build.

Was this page helpful?
0 / 5 - 0 ratings