-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUG] LiteDB 5.0.X crashes in iOS due to Emitting dynamic code #2082
Comments
+1 Spent hours today trying to figure out why only iOS was crashing in my Maui blazor hybrid app, and finally figured out how to get the actual error and stack trace. It was this same issue. Too bad it's still broken almost a year later. |
Does anybody found a solution? |
Not quite a solution but a workaround. You can try to use interpreter-mode instead of LLVM. Comes with a performance hit but is so far the only workaronud I found. |
We are also experiencing the same issue. Hope to see a fix soon |
Just ran into this as well Seems like an awfully important bug to be just... completely ignoring? LiteDB was always my go to for cross platform work, and missing iOS makes it pretty useless if I want to use something remotely recent. |
@lylerolleman Actually there has been some progress on Microsoft's side as well. As far as I understood there are supposed to be mitigations in .Net 8 preview 7 so that this exception shouldn't occur anymore. |
It worked for me |
It worked, thx |
The underlying issue seems to have been fixed in .NET 8 dotnet/runtime#87924 and as per my test it seems the repro above no longer crashes if targeting .NET 8! (even on device) |
This is still an issue for me in .NET 8 for iOS. |
@Digifais Do you have a repro for it? I have used the latest stable LiteDB on iOS with .NET 8 without issues so far |
@MartinZikmund Using Another example is: |
@MartinZikmund If you have any suggestions on how to fix/prevent this, that would be great. For now, I'm working around it by using the Mono interpreter for the LiteDB assembly only as such: Also, I'm not quite sure if this has been fixed, look at dotnet/runtime#94063 |
@Digifais Ours is currently looking like this:
We don't experience any more crashes linked to LiteDB in our Maui app on .Net 8. |
@DDHSchmidt As stated in my last comment, I'm indeed currently working around it by using As for my csproj, it's actually pretty basic, mind you, I'm not using MAUI but a native .NET for iOS app:
|
@Digifais Full linking is can full of worms and only as recent as .Net 9 Preview have Microsoft themselves acknowledged that it might be safe to use now ;) |
@DDHSchmidt Tried that before, makes no difference, even setting it to |
Version
LiteDB 5.X/iOS/.NET 6.0
Describe the bug
The LiteDB 5.0.X crashes in .NET 6.0 ios but LiteDB 4.0.X works fine.
The linq expressions used in 5.0.X seems not AOT friendly any more. The expression compiling of some of them trigger usage of
System.Reflection.Emit
.Code to Reproduce
https://github.com/ryancheung/LiteDB-iOS-Crash-Repro
Expected behavior
It should not crash with emitting dynamic code while
System.Linq.Expressions.Expression.Compile()
.Screenshots/Stacktrace
The text was updated successfully, but these errors were encountered: