Recent SQLite Version Errors

Just updating my SQLite dll using Nuget to version 1.0.81.0, I get errors like the ones below. This happens after the first successful execution one or more times (not sure). Vs2010 environment on x64 machine, but with customization of x86 build settings.

I am using SQLite for unit test NHibernate mappings. Often running into SQLite is a little "moody" in the past, I don't want to interfere with the unit test (see below)

Does anyone know what's wrong here?

Cheers
Berryl

Msg Error

Unable to copy file "...\x86\SQLite.Interop.dll" to "bin\Debug\x86\SQLite.Interop.dll". The process cannot access the file 'bin\Debug\x86\SQLite.Interop.dll' because it is being used by another process. Parties.Data.Impl.NHib.Tests 

Unit Test Fixture (enough to show file access anyway)

 public abstract class SQLiteTestFixture { protected override void BeforeAllTests() { _configureDbFile(); base.BeforeAllTests(); } protected override void AfterAllTests() { base.AfterAllTests(); _deleteAllDbFiles(); } #region Db File Maintenance /// <summary> /// Using a file is likely slower than just memory but not noticeably so far, /// AND seems to be a bit more stable /// </summary> private const string DB_FILE_SUFFIX = ".Test.db"; /// <summary> /// Just make some random file name with a known suffix, so we can clean up when done. /// </summary> private void _configureDbFile() { _dbFile = Path.GetFullPath(Guid.NewGuid().ToString("N") + DB_FILE_SUFFIX); // highly unlikely but just in case the same file is already out there _deleteDbFile(); } private void _deleteDbFile() { if (File.Exists(_dbFile)) File.Delete(_dbFile); } private static void _deleteAllDbFiles() { var files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*" + DB_FILE_SUFFIX); foreach (var file in files) { File.Delete(file); } } private string _dbFile; #endregion } 

}

+4
source share
3 answers

I had this problem with SQLite 1.0.88.0 with VS2010 and TestDriven.Net. I tried the answers to a few questions, but the only thing that worked for me was:

  • Tools -> Options -> TestDriven.Net -> General Information
  • In Run Run (s), Uncheck the "Cache Verification Process Between Test Runs"
  • Restart Visual Studio

Now you can run tests, debug tests, rebuild, etc., without restarting processes or Visual Studio.

+2
source

KB article describing one possible reason

most of the problems below are temporarily resolved

+1
source

Change the SQLLite dlls "Copy to output directory" to "Copy if new" performs the trick. (You need to restart VS after changing the property)

0
source

All Articles