-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 App crash (or does not work as expected) in Release mode when using default settings and sqlite #20342
Comments
I think there are a few things here:
To workaround this, you should be able to turn on the Mono Interpreter (Open your csproj and set Also, beyond the docs, the root issue in that library is not something that can be addressed in this repo. It's a AOT issue in the runtime, and would either need to be worked around in that library, or within the runtime. Maybe both. But not something that can be fixed in this repo, which is for the MAUI UI framework. |
Using the interpreter has major performance impacts that are worse than using version 1.7.335, so in my case that is the better workaround. I agree, I would really like to migrate to a different local storage library. And in the meantime, if sqlite-pcl-net is still the way to go, then the docs should mention that there are major limitations (or shouldnt recommend to use the latest version) and then I agree, this is all that can be done here. |
IMO while enabling the interpreter could potentially have impacts in your applications performance, I would be very surprised if it was that drastic turning it on for Release mode, considering that it is on by default for Debug applications. Of course, that should never be an intended solution to fixing this issue, it would be to fix it in the library and/or runtime. I believe the origins of the docs were based on Xamarin.Forms versions. It would have made more sense at the time to reference that specific library then, as it was very popular and used commonly within Xamarin apps. For MAUI, it was most likely ported from that version, as the library itself still works and the author of it hasn't "deprecated" it formally, as far as I can tell. So whoever wrote that doc probably had that in mind. Reading the doc, IMO, I don't think it was intended to be read as the "preferred" library or the "correct" library to use, but "one of" the ways to do it. As for EFCore (which is an MS developed library) that does have docs for Xamarin.Forms, which should probably get ported to MAUI at some point. Another important point with many of these ORM SQLite libraries and iOS/Mac, including EFCore and Dapper, is that you're going to have issues with them and NativeAOT (Which is, more or less, the same issue you're having right now with sqlite-net-pcl). SQLite libraries tend to use lots of reflection and that breaks AOT. EFCore is working on supporting it, and there is a Dapper.AOT library to help make sure you write code that works with AOT. The general solution for working around these libraries while they implement support for it is to... enable the Mono Interpreter. Again, this isn't a thing specific to MAUI UI, it's a library/runtime situation. |
Just FYI, I have done performance tests for the Interpreter in Release mode using iOS' hang detection with my app. I did see the docs for Xamarin.Forms and EF Core, but then that is as old as the latest updates for the pcl library, so I didnt think this would be safe to use either and I guess that is the case looking at your linked issue and following your explanations. Especially, if this is always the case when using sqlite, then it would be great if it could be updated in the docs for whichever library is recommended. |
@rolfbjarne Thoughts? |
This is a dotnet/runtime issue. |
Description
Following issue from 2021.
Using AOT compilation does give a warning that you should test your app in release mode, but the issue has been present since 2021 and the library is recommended in the official docs of MAUI.
Since many apps use and depend on this library, the docs should maybe give a warning about this explicitly or recommend to use version 1.7.335?
There has been a PR that claims to fix those issues.
Maybe, this could be resolved if someone from the MAUI team reaches out to the library owner?
Steps to Reproduce
Link to public reproduction project repository
Version with bug
8.0.6
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
use version 1.7.335
Relevant log output
Attempting to JIT compile method '(wrapper delegate-invoke) void
The text was updated successfully, but these errors were encountered: