praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.1k stars 1.42k forks source link

wrapper_managed_to_native_SQLitePCL_SQLite3Provider_dynamic_cdecl_MyDelegateTypes_sqlite3_prepare_v2_wrapper_aot_native_object_SQLitePCL_sqlite3_byte__int_intptr__byte__ #1045

Open brad302 opened 3 years ago

brad302 commented 3 years ago

Hi,

I've recently updated a bunch of Nuget packages in my Xamarin Forms app and I am now experiencing the aforementioned error in iOS on quite a regular basis.

I've managed to work around the issue by simply caching the data and not making the call to the DB each time I need that information.

The nuget packages related SQL lite and their versions in my app are ...

SQLitePCLRaw.core.2.0.4 SQLitePCLRaw.provider.sqlite3.ios_unified.1.1.14 SQLitePCLRaw.bundle_green.2.0.4 sqlite-net-pcl.1.8.0-beta

I upgraded to the beta package as you can see but it's the same behaviour as the latest stable package.

This is the stack trace from the crash ...

libsqlite3.dylib sqlite3_log libsqlite3.dylib sqlite3_exec libsqlite3.dylib sqlite3_exec libsqlite3.dylib sqlite3_exec libsqlite3.dylib sqlite3_exec cPanel.iOS wrapper_managed_to_native_SQLitePCL_SQLite3Provider_dynamic_cdecl_MyDelegateTypes_sqlite3_prepare_v2_wrapper_aot_native_object_SQLitePCL_sqlite3_byteint_intptrbyte :1 cPanel.iOS SQLitePCL_SQLite3Provider_dynamic_cdecl_SQLitePCL_ISQLite3Provider_sqlite3_prepare_v2_SQLitePCL_sqlite3_SQLitePCL_utf8z_intptrSQLitePCLutf8z :1 cPanel.iOS SQLitePCL_raw_sqlite3_prepare_v2_SQLitePCL_sqlite3_SQLitePCL_utf8z_SQLitePCL_sqlite3stmt :1 cPanel.iOS SQLitePCL_raw_sqlite3_prepare_v2_SQLitePCL_sqlite3_string_SQLitePCL_sqlite3stmt :1 cPanel.iOS SQLite_SQLite3_Prepare2_SQLitePCL_sqlite3_string :1 cPanel.iOS SQLite_SQLiteCommand_Prepare :1 cPanel.iOS SQLite_SQLiteCommandExecuteDeferredQueryd12_1_T_REF_MoveNext :1 cPanel.iOS System_Collections_Generic_List_1_T_REF_AddEnumerable_System_Collections_Generic_IEnumerable_1_T_REF cPanel.iOS System_Collections_Generic_List_1_T_REF__ctor_System_Collections_Generic_IEnumerable_1_T_REF cPanel.iOS ToCollection.cs:30 cPanel.iOS SQLite_SQLiteCommand_ExecuteQuery_T_REF :1 cPanel.iOS SQLite_TableQuery_1_T_REF_ToList :1 cPanel.iOS SQLite_TableQuery_1_T_REF_FirstOrDefault :1 cPanel.iOS AppHelper.cs:81 cPanel.iOS OrdersService.cs:96 cPanel.iOS AsyncMethodBuilder.cs:471 cPanel.iOS cPanel_Services_OrdersService_GetOrders_cPanel_Models_Requests_GetOrder_GetOrderRequest cPanel.iOS OrderPage.xaml.cs:837 cPanel.iOS AsyncMethodBuilder.cs:316 cPanel.iOS cPanel_Pages_OrderPageOnAppearingb239_2 cPanel.iOS System_Threading_Tasks_Task_1_TResult_REF_InnerInvoke cPanel.iOS System_Threading_Tasks_Task_Execute cPanel.iOS System_Threading_Tasks_Task_ExecutionContextCallback_object cPanel.iOS System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool cPanel.iOS System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool cPanel.iOS System_Threading_Tasks_Task_ExecuteWithThreadLocal_System_Threading_TasksTask cPanel.iOS System_Threading_Tasks_Task_ExecuteEntry_bool cPanel.iOS System_Threading_Tasks_Task_System_Threading_IThreadPoolWorkItem_ExecuteWorkItem cPanel.iOS System_Threading_ThreadPoolWorkQueue_Dispatch cPanel.iOS Runtime.cs:289 cPanel.iOS System_Threading__ThreadPoolWaitCallback_PerformWaitCallback cPanel.iOS wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr cPanel.iOS mono_jit_runtime_invoke mini-runtime.c:3164 cPanel.iOS mono_runtime_try_invoke object.c:3052 cPanel.iOS worker_callback threadpool.c:292 cPanel.iOS worker_thread threadpool-worker-default.c:502 cPanel.iOS start_wrapper_internal threads.c:1233 cPanel.iOS start_wrapper threads.c:1308 libsystem_pthread.dylib _pthread_start libsystem_pthread.dylib thread_start

The point of failure is at the call where I am taking the returned results and retrieving the first value ...

var account = App.DatabaseConnection.Table<Account>().Where(
    x => x.Selected.Equals(true)
);

_defaultAccount = account.FirstOrDefault();

Keen to get your thoughts on this.

Let me know if there's anything else you need.

Thanks

Brad

Jan-Duchateau commented 2 years ago

I'm having the same issue. Any updates on this?

arogerspro commented 2 years ago

@brad302 did you ever resolve this. I am also having the same issue on iOS devices.