2

So I have some classes that I have been storing in a local SQLite DB in a Xamarin Forms application. Works fine on UWP, Android, and iOS except for Release on a physical device. Keep getting JIT warnings. I've tried removing linking various ways to ensure it's getting compiled but no dice. The root of the issue seems to be within the usage of SQLite-Net-pcl nuget library. Does anyone have advice on how to ensure that code has been AOT compiled? My abstract class, maybe too abstract? Not sure.

public abstract class SqlRepositoryLite<T, TInterface> : IRepositoryLite<TInterface> where T : class, IDto, TInterface, new()
{
 
    public IEnumerable<TInterface> Items => Connection.Table<T>();

Crash reports:

SIGABRT: Attempting to JIT compile method '(wrapper delegate-invoke) void <Module>:invoke_callvirt_void_CharacterItem_int (PFAssistant.Core.Services.CharacterItem,int)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.

Stacktrace:

FastColumnSetter+<>c__DisplayClass2_0`2[ObjectType,ColumnMemberType].<CreateTypedSetterDelegate>b__0 (System.Object o, SQLitePCL.sqlite3_stmt stmt, System.Int32 i)
SQLiteCommand+<ExecuteDeferredQuery>d__12`1[T].MoveNext ()
List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable)
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) <0x1052cce30 + 0x0021f> in <25bf495f7d6b4944aa395b3ab5293479#0dcf7231fb8229d159bd9a1419156fe3>:0
Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source)
SQLiteCommand.ExecuteQuery[T] ()

Update: Would seem updating Sqlite-net-pcl to v1.8.116 was a major part of my issue, had issues with 1.6.292 as well. 1.7.335 worked perfectly.

  • 3
    https://github.com/praeclarum/sqlite-net/issues/1070 this issue seems related – Cheesebaron Nov 27 '21 at 23:06
  • v1.8.116 was part of the culprit, I downgradedto 1.6 and it also had issues. Seems there can also be issues with serialization on some properties that cause this error to be thrown. Thanks a lot Cheesebaron, was about to give up on things. – Christopher Richmond Nov 28 '21 at 01:17

1 Answers1

2

I found the same to be the case today. Downgrading to 1.7.335 is the solution.

JR Lawhorne
  • 3,192
  • 4
  • 31
  • 41