Bug 25111 - Mono.Data.Sqlite Attempt to write a read-only database exception on x86_64 API 21
Summary: Mono.Data.Sqlite Attempt to write a read-only database exception on x86_64 AP...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.20.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-12-05 12:40 UTC by John Miller [MSFT]
Modified: 2014-12-23 12:21 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 Developer Community or GitHub 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.

Related Links:

Description John Miller [MSFT] 2014-12-05 12:40:23 UTC

   Mono.Data.Sqlite will throw exceptions that the database is read-only when running on API 21 x86_64 emulators. 

**Steps to Reproduce:**

   1. Create an Android 5.0 API 21 emulator using the Atom x86_64 (you will need Intel HAXM installed)
   2. Run the attached sample on that emulator

**Actual Results:**

   It will crash with an exception message "Attempt to write a read-only database". 

**Expected Results:**

   No crash.

**Build Date & Platform:**

   Mono 3.10
   Android 5.0 x86_64

**Additional Information:**

   I did not have a device that was 64 bit to test this on. It may not be specific to emulators. 
   It works on x86 emulators
   It works on 32 bit Android 5 devices. 
   The database file does not appear to be read-only (-rwxrwx--- root     sdcard_r    10240 2014-12-02 11:15 DatabaseName.db)
   Possible explanation: http://stackoverflow.com/a/27013698
   The SO article points to a bug report for the issue being in Sqlite: https://code.google.com/p/android/issues/detail?id=79994
Comment 2 Jonathan Pryor 2014-12-19 12:28:32 UTC
This appears to be an Android bug, in that 32-bit processes running on 64-bit targets can't access external directories: