Xamarin.iOS SQLiteException - file is encrypted or is not a database

I am using sqlcipher for xamarin ios version=4.0.0.1 and SQLite version reported is 3.1.1.0
The app was working fine before we upgraded from iOS sdk from 9 to 11. The app crashes on launch for many users (not all) in this update which was smooth in our previous updates and it not reproducible in our device simulator. Looking at the xcode device logs on one of the iPad connected which was having the crash, I see the following:

Exception is: SQLiteException - file is encrypted or is not a database

At the time of the exception, the container was:

Resolving Shared.ViewModels.MainViewModel,(none) (mapped from Shared.ViewModels.IMainViewModel, (none))
Resolving parameter “settingsService” of constructor Shared.ViewModels.MainViewModel(Shared.Services.ILifecycleService lifecycleService, Shared.Services.ISettingsService settingsService, Shared.Services.ISyncService syncService, Shared.Common.ITimerService timerService, Shared.Common.IDispatcherService dispatcherService, Shared.Common.IExten<\M-b\M^@\M-&>
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: Stacktrace:
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical:
Native stacktrace:
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 0 iOSTablet 0x00000001042d76a4 sqlite3_sleep + 31848372
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 1 libsystem_platform.dylib 0x00000001871c7b44 _sigtramp + 52
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 2 libsystem_pthread.dylib 0x00000001871cd354 + 396
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 3 libsystem_c.dylib 0x0000000187028fd8 abort + 140
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 4 iOSTablet 0x000000010440fea8 xamarin_get_block_descriptor + 4592
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 5 iOSTablet 0x000000010431e338 sqlite3_sleep + 32138312
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 6 iOSTablet 0x00000001042d71e4 sqlite3_sleep + 31847156
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 7 iOSTablet 0x00000001042d6224 sqlite3_sleep + 31843124
Jan 3 10:51:43 TMs-iPad iOSTablet(CFNetwork)[486] : Faulting in NSHTTPCookieStorage singleton
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 8 iOSTablet 0x00000001042ce1d0 sqlite3_sleep + 31810272
Jan 3 10:51:43 TMs-iPad iOSTablet(CFNetwork)[486] : Faulting in CFHTTPCookieStorage singleton
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 9 iOSTablet 0x0000000102865b88 sqlite3_sleep + 4119704
Jan 3 10:51:43 TMs-iPad iOSTablet(CFNetwork)[486] : Creating default cookie storage with default identifier
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 10 iOSTablet 0x00000001025811a8 sqlite3_sleep + 1086136
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 11 iOSTablet 0x0000000102836644 sqlite3_sleep + 3925844
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 12 iOSTablet 0x00000001042e6790 sqlite3_sleep + 31910048
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 13 iOSTablet 0x000000010435fe44 sqlite3_sleep + 32407380
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 14 iOSTablet 0x0000000104362fa4 sqlite3_sleep + 32420020
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 15 iOSTablet 0x00000001042ca9f4 sqlite3_sleep + 31795972
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 16 iOSTablet 0x0000000104414c68 xamarin_localized_string_format_9 + 3232
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 17 iOSTablet 0x0000000102580d48 sqlite3_sleep + 1085016
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical: 18 libdyld.dylib 0x0000000186f8a56c + 4
Jan 3 10:51:43 TMs-iPad iOSTablet[486] : critical:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

I am looking at the possible scenarios that message is logged. I was looking at other article about the xcode upgrade below and was wondering if that has anything to do with our Xamarin environment as well?

Any suggestions on what the root cause of the issue might be?

Hi @sri,

Can you try updating to the latest SQLCipher for Xamarin iOS component and let us know if that addresses the issue you are experiencing? The current version is 4.1.4.1. Thanks!

@developernotes
Thanks for the quick response. We sure can update to the latest version. Do you know of any development updates that might cause the current version we are using to give this message? Thanks!

Hi @sri

Excellent, we look forward to hearing your results. It is difficult to say. If it continues to be an issue, it may be beneficial to review an example scenario where you experience the issue.