I have a WPF application that uses SQL Server Compact Edition 4.0 to store data on a local computer. I experience random but fairly frequent crashes in the Compact Edition 4.0 database. He always gives the same error ....
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
... with the following limited stack trace ...
at System.Data.SqlServerCe.NativeMethodsHelper.SafeRelease(IntPtr& ppUnknown) at System.Data.SqlServerCe.SqlCeCommand.ReleaseNativeInterfaces() at System.Data.SqlServerCe.SqlCeCommand.Dispose(Boolean disposing) at System.Data.SqlServerCe.SqlCeCommand.Finalize()
I have a separate thread that I use for all calls to the CE database, so I know that all my database calls are serialized (there are no simultaneous calls in the database), and they all happen on the same thread. When an exception occurs, it always has the data above.
This is not reproducible, but it often happens that my application never lasts more than 10 minutes of work. Sometimes it crashes in the first few seconds, and sometimes up to 10 minutes, but most likely somewhere between the two extremes.
I cannot find anything useful from Google and I hope that this is a problem that others might see and have a workaround. Thanks.
source share