-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Not working on iOS after 1.8.116 - Attempting to JIT compile method '(wrapper delegate-invoke) #1067
Comments
same problem with SQLiteConnection.Query() |
stack trace for me: at SQLite.FastColumnSetter+<>c__DisplayClass2_0 |
Same error here. 1.7.335 works but 1.8.116 fails
|
I'm having the same issue as above, I've tried, .Table().Where(x => x...) and .Query("query"), same issue, also with using 'ugly' I thought it might solve the issue, but still getting the same issue |
There has been no response on this so I'll share my diagnosis: https://stackoverflow.com/questions/24588090/makegenericmethod-makegenerictype-on-xamarin-ios |
pull request with workaround |
I think you're spot on @paul-kiar, |
I don't think that this is the problem because the MakeGeneric fixed this case
Besides The Version before already had this Compilation Bug. The workaround would be to AOT Compile with enabled Interpreter but this doesn't work because of another Bug. Which seems not been merged yet into the release mono runtime. |
I think the real solution for fixing this would be to write a Source Generator that uses the interface that I have added in this pull request. Then It will be even faster and AOT safe. |
It may not work for everyone, but I downgraded to 1.7.335 and my queries are working again. |
This worked for me too. I landed here after almost going insane trying to figure out why our app was failing at runtime, since it works fine in debug mode on a simulator. Being very grateful for all the work that has gone into this project already, I hope @praeclarum finds the time to update this library or incorporate the already existing PR since this is the de-facto standard for local storage on mobile devices (Xamarin developer here), and I would assume a lot of developers are affected. Best regards & Thanks |
Also facing this issue after updating to 1.8.116. Downgraded back to 1.7.335 as a temporary workaround. If it helps, here is my stack trace:
UPDATE: I wanted to add that the exception is only thrown, if the project setting Enable the Mono interpreter is disabled (which should be typically the case for the Release-build). You will not see the exception in Debug-configuration. |
The existing PR doesn't really fix the problem, it just pushes the optimization of the generated run-time compiled code onto the consumer programmer. Maybe there is a way to compromise where the performance is increased but there doesn't need to be run-time compiled code. Try to generate code, if the platform doesn't support it fail over to the old way. Or maybe some way of providing a generic method on your class that will set the property without boxing. |
@inforithmics @tualatin but to enable the mono interpreter should not be used for AppStore/Release builds as mentioned above by @thomaskaelin , right? |
Wondering whether this will ever be adressed. a) developer (@praeclarum) seems to have moved on to other projects or at least this project is not a priority. This is their prerogative, they have no obligation at all and I am thankful that they have built this library at all.
This error still occurs in Xamarin.Forms as well as MAUI for us, about a year after it first appeared.
Will there ever be a resolution to this? |
@Hottemax as they wrote, changing to enable the mono interpreter also avoid this error. Also the .ipa size was reduced by the half on my project. Currently i'm at this point to finish the project. I will now try to send the build with "mono interpreter enabled" to app store review and tell you what happens if you want. Question to you: Is this option no point for you? If not, why? |
@stoff99 I have not checked this "workaround" because Others will come after us, use MAUI/Xamarin and SQLite with default settings and latest versions, and not having found this thread, and their app will not work/break in production. |
About the apple review: |
Yeah, this works at the moment without problems. But I hope, this bug will fix as soon as possible. |
I'm having this issue |
@breenbob try to add --interpreter to “Additional mtouch arguments” |
Thanks for posting this guys. Totally saved my sanity!! I have exactly this issue and rolling back to 1.7.335 works for me. Thanks @Hottemax for the [ ] trick. |
Any news on this? |
maybe
|
Almost 3 years passed, any updates on this, or this project is buried? |
We are facing this issue with .NET MAUI now. And interpreter is not working also. Is there any method we can check the interpreter is really working? |
@praeclarum |
Facing a similar issue with .NET MAUI. Using the Interpreter works for us but had bad impact on the overall performance. Is there any way to fix this? |
@phillippschmedt you talking about debug or did you try also with release config? |
@stoff99 I am talking about the general app performace in release mode. Like navigating etc. It slows down for me when enabling the interpreter. |
Any updates? |
This is still an issue as of 4/4/24 using any of the two latest sqlite-net-pcl versions above 1.7.335 in .NET MAUI. (yes, it worked for me after downgrading from the 1.8.116 and the most current 1.9.172) That will teach me to upgrade any nuget components unless absolutely mandatory for feature requirements or security reasons. It feels like every time I do, I end up with more problems than I started with. I guess they don't make 'em like they used to. I lost about 10hrs of testing and research until I finally landed here, only to be disappointed that I have to go backwards instead of forward to fix my issue. If I was the one that broke this feature, I'd sure try to make time to fix it before moving on to something else. But that's just me. I greatly appreciate all of the contributors and their feedback to this problem. It helped and saved me probably another 10hrs of frustration. Now, I get to go back in and find all of the things I changed during testing (that I doubted) and get it back to work again. :-) |
I had the same problem on iOS running net8.0-ios release mode app using sqlite-net-pcl v1.8.116 Stacktrace pointing to same issue:
In this case I am using the query method like:
The solution with UseInterpreter does work, however that's not what you would like.
I was quite surprised this still isn't fixed. Without investigating the source but after reading the comments I think the needs to check if dynamic code is supported:
After some more investigation the strange thing was that for some DbConnection.Query calls it worked fine but some crashed. After some more investigation I was able to fix my problem. It depended on the definition of the type you are querying into: In my case something like (simplified for example):
The difference with the other queries were the setters on the interface. After removing the interface setters (which I didn't need) everything worked fine like:
The moral is maybe it does work if you are querying into plain POCO objects without interfaces, etc ? Does anyone have the same experience ? |
@JeroenBer As already mentioned in other discussions the issue was introduced with this PR which uses code generation: #902 - I took the latest master, removed these parts and copied the files to my project. Everything runs fine again. |
I found the exact same issue. Between versions of my app all of a sudden I was getting this error on iOS unless I enabled the mono interpreter. Couldn't figure out why. Hadn't updated any libraries. Your comment pointed me in the right direction. I had changed one of my existing classes to implement an interface. Undoing that fixed it. I can also confirm that removing the setters fixed it, however I need those so that doesn't work for me. |
Hi, Any chance you could elaborate on how to do this? I've dowloaded the latest repo but I can't figure out which bits of code I need to remove or how to explicitly remove that commit (also it says here that it's MakeGenericMethod that's the problem, I can find that in the source but i can't see a reference to it in that commit). Tried rolling back to 1.7.x but that's giving me other issues. cheers |
Maybe this can be a workaround - enable the interpreter for only needed assemblies.
|
@Madde88 thank you so much! About 5 issues are created around this problem. Just to sum up all solutions gathered around (all worked in my case) from best to worst IMO:
|
the silence by @praeclarum is so weird - since there were even new releases, and this is the most commented on issue in the entire repository.
We still have no idea what is going here, or what we can do to support @praeclarum to incorporate a fix, besides creating a PR for it, which has been done already? |
Maybe if they didn't inexplicably drop him as an MVP he'd maybe feel a little more invested, considering the plugin is used by most MAUI store apps. Went with using the interpreter in the short term and really noticed no performance issues in release mode but will tweak to use the approach @Madde88 outlined when we make a new release. |
Steps to reproduce:
Error:
Attempting to JIT compile method '(wrapper delegate-invoke) void :invoke_callvirt_void_UserInfo_Guid (Skandy.Mobile.Domain.UserInfo,System.Guid)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information. ; Version: 1.6.408. iOS: 8C36CE78-3988-40D7-9CDB-54BF1677E694
at SQLite.FastColumnSetter+<>c__DisplayClass2_0
2[ObjectType,ColumnMemberType].<CreateTypedSetterDelegate>b__0 (System.Object o, SQLitePCL.sqlite3_stmt stmt, System.Int32 i) <0x1059bd710 + 0x00187> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.SQLiteCommand+<ExecuteDeferredQuery>d__12
1[T].MoveNext () <0x1059e7ec4 + 0x0031f> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at System.Collections.Generic.List1[T].AddEnumerable (System.Collections.Generic.IEnumerable
1[T] enumerable) <0x104f40934 + 0x000b3> in <da8885cdf78b449d96de00cdb9d47225#a6464d95a03c7bacba393abaab79514c>:0 at System.Collections.Generic.List1[T]..ctor (System.Collections.Generic.IEnumerable
1[T] collection) <0x104f3e330 + 0x00193> in <da8885cdf78b449d96de00cdb9d47225#a6464d95a03c7bacba393abaab79514c>:0 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) <0x105652e54 + 0x00093> in <26bd496943a145e18f2cd8379c502c52#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.SQLiteCommand.ExecuteQuery[T] () <0x1059e64b4 + 0x00073> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.TableQuery
1[T].ToList () <0x1059efeb0 + 0x00063> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.TableQuery1[T].FirstOrDefault () <0x1059f0084 + 0x0002b> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.SQLiteConnection.Find[T] (System.Linq.Expressions.Expression
1[TDelegate] predicate) <0x1059dd4a4 + 0x00047> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.SQLiteAsyncConnection+<>c__DisplayClass70_01[T].<FindAsync>b__0 (SQLite.SQLiteConnectionWithLock conn) <0x1059f5a88 + 0x00047> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at SQLite.SQLiteAsyncConnection+<>c__DisplayClass32_0
1[T].b__0 () <0x1059f4b14 + 0x0006f> in <01c96d411fe34bd5940c99a56515582b#a6464d95a03c7bacba393abaab79514c>:0 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () <0x104e432a8 + 0x000bb> in <da8885cdf78b449d96de00cdb9d47225#a6464d95a03c7bacba393abaab79514c>:0 at System.Threading.Tasks.Task.Execute () <0x104e4796c + 0x00023> in <da8885cdf78b449d96de00cdb9d47225#a6464d95a03c7bacba393abaab79514c>:0 ---The text was updated successfully, but these errors were encountered: