aspnet/Microsoft.Data.Sqlite

System.AccessViolationException on encrypted database

Closed this issue · 7 comments

I couldn't reopen #480.

I'm getting this again with

error

This happens after a long unit test writing different tables.

Maybe this is due to an upgrade of sqlcipher from 1.1.8 to 1.1.11.
Installed packages:

    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
    <PackageReference Include="Microsoft.Data.SQLite" Version="2.0.1" />
    <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="2.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.3" />
    <PackageReference Include="SQLitePCLRaw.bundle_sqlcipher" Version="1.1.11" />
    <PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.11" ExcludeAssets="All" />

Does adding this reference help?

<PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" />

Why should this help? The error occurs after many writes and reads.

If I remember right, it was caused by a race condition on Dispose or finalize that was fixed in the latest version of SQLitePCL.raw. The only way I was able to repro it last time was by mixing package versions. You're depending on 2.0 versions of ASP.NET and Microsoft.Data.SQLite, so it's possible that this package is still at 1.1.7.

Thx, I will try tomorrow.

This seems to work, thx.
But: If the compatibility of a library breaks, you should document it somehow and increment the major version number.

This wasn't an intentional compatibility-breaking change. And if we were to document it now, those docs would say: "One or two people have experienced a problem, and we don't really know exactly what's happening, but mixing package versions seems to be the only way to repro it."

FYI:
In an another stress test, I've got this error again despite adding <PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" />.
I switched back to 1.1.8 and it passed the test.
Because I don't have the time anymore to make more tests, I will not be able to give you guys any further feedback, which is why I keep this issue closed.