Closed ryanlpoconnell closed 1 year ago
Hi @ryanlpoconnell , thank you for contacting us!
This looks like a conflict of sqlite3 usage of AppCenter SDK and Microsoft.Datasync.Client.SQLiteStore
. Based on the source that the exception comes from, I would suggest you to open an issue in azure-mobile-apps repo.
Meanwhile we are still looking into it and will update on progress.
I have duplicated the issue under https://github.com/Azure/azure-mobile-apps/issues/573 as you have suggested.
RE https://github.com/Azure/azure-mobile-apps/issues/573 this has been Closed but unactioned as apparently it does not have "official support".
I understand the problem is two components incompatible due to depending on the same underlying library...
But given that under time pressure I will need to choose one of these libraries to ditch, it would need to be AppCenter...
Is there any scope for compatibility to be addressed as part of the AppCenter team?
I still think it is ludicrous that two mobile centric Microsoft components cannot work together and that there are no plans for Microsoft to address this.
Facing same issue in our app too.
@ryanlpoconnell @Arslan007 after looking into it, here is what I found
raw.sqlite3_config(raw.SQLITE_CONFIG_URI, 1)
returns (21) SQLITE_MISUSE
(see https://sqlite.org/rescode.html).
OfflineSQLiteStore
throws exeption if setting raw.SQLITE_CONFIG_URI
doesn't return SQLITE_OK
. I believe this behaviour can be improved avoiding throwing, as it is done in app center sdk.
The reason why SQLITE_MISUSE
is returned is because the AppCenter SDK already set this flag. See MSACDBStorage.m#L542. However sdk doesn't throw if setting the flag fails. See MSACDBStorage.m#L41.
So, there is nothing AppCenter SDK can do to solve this issue. It should be fixed on the azure-mobile-apps side.
Initialize OfflineSQLiteStore
first, then call AppCenter.Start
. This way OfflineSQLiteStore
will set the flag successfully, then AppCenter SDK will fail setting the flag but won't crash. After that, you will be OK using both libs.
I'm closing it as not an SDK issue.
@DmitriyKirakosyan Thanks for looking into it. Yes it worked.
Description
Using
AppCenter.Start()
withOfflineSQLiteStore()
in Maui iOS causes SQLite MISUSE and throws "Unable to configure sqlite3 for URI connection strings.".The following line of code will fail for Maui iOS if
AppCenter.Start()
is called during startup (But works as expected with Maui Android)...var store = new OfflineSQLiteStore(connectionString);
To clarify using OfflineSQLiteStore from Microsoft.Datasync.Client.SQLiteStore works for Maui iOS using simplified example code from ... https://learn.microsoft.com/en-us/azure/developer/mobile-apps/azure-mobile-apps/quickstarts/maui/offline?pivots=vs2022-mac ... until using this line in App.xaml.cs > OnStart()
Microsoft.AppCenter.AppCenter.Start("ios=appid;android=appid",typeof(Microsoft.AppCenter.Analytics.Analytics), typeof(Microsoft.AppCenter.Crashes.Crashes));
Exception.Message = "Unable to configure sqlite3 for URI connection strings." Exception.Source. ="Microsoft.Datasync.Client.SQLiteStore"
NOTE: I believe the message re URI is a red herring due to the way any non-success result is handled in SQLiteConnection
Developer is only able to determine sqlite misuse error response RE Application output (see repro steps)
Repro Steps
Please list the steps used to reproduce your issue.
Microsoft.AppCenter.AppCenter.Start
is contributing to this issue, comment the line of code in App.xaml.cs > OnStart() > Line 19 and repeat steps 1-5Details
Screenshot