In a compact framework .NET 3.5 application running on Windows Mobile 5 we are seeing the following error message being logged:
Could not load database compaction library. Operation has been aborted.
at System.Data.SqlServerCe.SqlCeEngine.ProcessResults(IntPtr pError, Int32 hr)
at System.Data.SqlServerCe.SqlCeEngine.Repair(SEFIXOPTION option, String dstConnStr, RepairOption repairOption)
at System.Data.SqlServerCe.SqlCeEngine.Compact(String connectionString)
in:
SQL Server Compact ADO.NET Data Provider
The application is issuing a command to compact a SQL Server Compact database file and receiving the error response above.
The error message occurs intermittently; sometimes the compact operation will complete and sometimes the error above is logged.
Googling this error message yields some results which suggest a lack of memory (or the right sort of memory) being the cause but this error does not occur consistently across all device platforms. Some Windows Mobile devices from a particular manufacturer never get this error and those from another manufacturer have this error more often than not.