Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I have a Sqlite database that I include with my MonoTouch app. It has worked fine for me so far, but now I want to open it in read-only mode rather than read-write.
So I have changed the connection string to include 'Read Only=True', but when I call Open(), I get the following error:
Library used incorrectly (at Mono.Data.Sqlite3.Open)
If I dig into the exception it shows
_errorCode = Misuse
and that's about all the info it gives.
Here's the code:
var _conn = new SqliteConnection("Data Source=db/sampleDb;Read Only=True");
This relates to a Stack Overflow item here: http://stackoverflow.com/questions/8602726/cant-open-sqlite-database-in-read-only-mode
The answer was:
"You found a bug in Mono.Data.Sqlite.dll.
The Create flag is appended (by default) before the ReadOnly flag is parsed and set. The resulting flag is invalid and sqlite reports an error.
I will fix this for future releases (of Mono and MonoTouch...). If this blocks you then please open a bug report on http://bugzilla.xamarin.com and I'll attach a fixed assembly (with instructions to replace the existing one) to the bug report."
Created attachment 1125 [details]
This is already fixed (from stackoverflow) in 4b577de71a25729cbdf0f744154a7b746899aa3d
So it will be part of MonoTouch 5.2.
In the mean time you can use the attached assembly (on top of MonoTouch 5.x) by doing the following:
1) backup your /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Sqlite.dll and /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Sqlite.dll.mdb files
2) copy the attached file to /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Sqlite.dll
3) remove the /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Data.Sqlite.dll.mdb symbols (they won't match anymore)
4) clean, rebuild and test your application
Let me know if there are any issue with the updated assembly.