{"action":"created","issue":{"url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/106","repository_url":"https://api.github.com/repos/ericsink/SQLitePCL.raw","labels_url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/106/comments","events_url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/106/events","html_url":"https://github.com/ericsink/SQLitePCL.raw/issues/106","id":181749002,"number":106,"title":"Unable to use the new \"SQLitePCL.raw.sqlite3_config()\" to set threading mode","user":{"login":"ggirard07","id":2625886,"avatar_url":"https://avatars.githubusercontent.com/u/2625886?v=3","gravatar_id":"","url":"https://api.github.com/users/ggirard07","html_url":"https://github.com/ggirard07","followers_url":"https://api.github.com/users/ggirard07/followers","following_url":"https://api.github.com/users/ggirard07/following{/other_user}","gists_url":"https://api.github.com/users/ggirard07/gists{/gist_id}","starred_url":"https://api.github.com/users/ggirard07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggirard07/subscriptions","organizations_url":"https://api.github.com/users/ggirard07/orgs","repos_url":"https://api.github.com/users/ggirard07/repos","events_url":"https://api.github.com/users/ggirard07/events{/privacy}","received_events_url":"https://api.github.com/users/ggirard07/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-10-07T19:25:47Z","updated_at":"2016-11-09T14:33:22Z","closed_at":null,"body":"**Steps to reproduce**\n1. Create a new solution with a PCL project (in my case profile 259).\n2. Add a platform specific project with a dependency to the PCL (in my case Android).\n3. Add necessary packages to those projects to use the bundle green edition.\n4. From the PCL code, configure SQLite in serialized mode:\n\n```\nSQLitePCL.Batteries.Init();\nvar result = SQLitePCL.raw.sqlite3_config(SQLitePCL.raw.SQLITE_CONFIG_SERIALIZED);\nif (result != SQLitePCL.raw.SQLITE_OK)\n{\n    System.Diagnostics.Debug.WriteLine($\"Unable to set SQLIte in Serialized mode (error code = {result})\");\n}\n```\n\n**Expected result**\nAs I am understanding that bundles and providers are used to inject platform specific bits from the PCL by using bait/switch, this should be considered a possible case.\n\n**Actual result**\nConfig call is failing and returning a SQLITE_MISUSE error.\n\n**Remarks**\nSQLite serialized mode cannot be set after `SQLitePCL.Batteries.Init()` or `SQLitePCL.raw.SetProvider()` as this last call try to open then close the DB which internally init the SQLite library. Once SQLite has been initialized, this is no longer permitted to use config to set the threading mode and result in a misuse error.\nEven by doing so at the platform level, `SQLitePCL.raw.sqlite3_config()` still requires to call Init or SetProvider first, which prevent usage.\n\nI am not sufficiently experienced with SQLite and your libraries to determine if there is an other way to validate the lib injection other than by opening/closing it...\n"},"comment":{"url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/comments/259428071","html_url":"https://github.com/ericsink/SQLitePCL.raw/issues/106#issuecomment-259428071","issue_url":"https://api.github.com/repos/ericsink/SQLitePCL.raw/issues/106","id":259428071,"user":{"login":"ericsink","id":3877005,"avatar_url":"https://avatars.githubusercontent.com/u/3877005?v=3","gravatar_id":"","url":"https://api.github.com/users/ericsink","html_url":"https://github.com/ericsink","followers_url":"https://api.github.com/users/ericsink/followers","following_url":"https://api.github.com/users/ericsink/following{/other_user}","gists_url":"https://api.github.com/users/ericsink/gists{/gist_id}","starred_url":"https://api.github.com/users/ericsink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericsink/subscriptions","organizations_url":"https://api.github.com/users/ericsink/orgs","repos_url":"https://api.github.com/users/ericsink/repos","events_url":"https://api.github.com/users/ericsink/events{/privacy}","received_events_url":"https://api.github.com/users/ericsink/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T14:33:22Z","updated_at":"2016-11-09T14:33:22Z","body":"The pre-release of 1.1.1 (now on nuget.org) addresses this issue.\r\n\r\nraw.SetProvider() no longer calls open/close, so sqlite3_initialize() should not end up getting called.\r\n\r\nFor WinRT-ish platforms, we still have the problem that the pinvoke provider constructor calls sqlite3_win32_set_directory(), and I can't remove those calls without breaking apps.  The workaround for that is to call sqlite3_shutdown(), then sqlite3_config(), then re-call sqlite3_win32_set_directory, which is now made available for that purpose."}}
{"actor":{"display_login":"ericsink"}}