System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: bb47a349562ac4e0e60cf35da0ce4a27481bc73b
Title: Microsoft.VisualStudio.TestTools.UnitTesting does not close testing app so SQLite.Interop.dll is not unloaded so rebuilding the test raise a compilation error
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Integration_Via_PInvoke Resolution: Works_As_Designed
Last Modified: 2015-03-04 19:20:46
Version Found In: 1.0.94.0
User Comments:
anonymous added on 2015-02-24 12:41:50:
Microsoft.VisualStudio.TestTools.UnitTesting does not close testing app.
As a result, SQLite.Interop.dll is not unloaded at the end of test.
When you try to rebuild the compiler raises an error (2 errors).

4>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3921,5): error MSB3027: Could not copy "C:\Develop\ForPlanning\ForAnalysis\ForAnalysis.OlapEngine.Test\x86\SQLite.Interop.dll" to "bin\x86\Debug\x86\SQLite.Interop.dll". Exceeded retry count of 10. Failed.
4>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3921,5): error MSB3021: Unable to copy file "C:\Develop\ForPlanning\ForAnalysis\ForAnalysis.OlapEngine.Test\x86\SQLite.Interop.dll" to "bin\x86\Debug\x86\SQLite.Interop.dll". The process cannot access the file 'bin\x86\Debug\x86\SQLite.Interop.dll' because it is being used by another process.

When I'm closing tests I'm doing also 
connection.Close();
connection.Dispose();
SQLiteConnection.ClearAllPools();
SQLiteConnection.Shutdown(false, false);

but with no results.

I thought that shutdown was the method to unload the interop library...
Probably with a method to unload the interop library I could solve everything.

mistachkin added on 2015-02-24 15:54:15:
The "SQLite.Interop.dll" native interop assembly is linked to the managed code via
P/Invoke, so it cannot be explicitly unloaded.  Instead, the containing process
must exit for it to be unlocked.