I've tried to run the application in two situations: with SQL Server compact edition (3.5) installed and one without. When SQL Server Compact edition isn't installed, I get the following error:
Exception :Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.
Inner Exception :
========================
Stack Trace :
========================
at System.Data.SqlServerCe.NativeMethods.CloseStore(IntPtr pSeStore)
at System.Data.SqlServerCe.SqlCeConnection.ReleaseNativeInterfaces()
at System.Data.SqlServerCe.SqlCeConnection.Dispose(Boolean disposing)
at System.Data.SqlServerCe.SqlCeConnection.Finalize()
Source :
========================
System.Data.SqlServerCe
----------------------------------------------------------
I'm handling Unhandled exceptions using this method.
I am getting this error from a console application which I'm starting from a Windows Form. In both the application I've inserted the Unhandled Exception coding and it's getting executed and getting returned to the text file, and the Microsoft 'report error' dialog is getting generated; how do I keep that from happening? How do I troubleshoot what is causing this issue?
When I had this issue, the problem was the database connection:
If you don't close the connection before reopen it, you get this error arround "System.Data.SqlServerCe
".
Just adding this line solved my issue:
SqlCeConnection conn = new SqlCeConnection(_connectionString);
conn.Close(); //adding this.
if(conn == ConnectionState.Open) {
//-- Your code here.
}
The native SQL Compact code is crashing. That's very unusual. And very unlikely to be caused by your code. Not the kind of problem you could ever debug, you don't have anything but machine code to look at. If you run any other in-process unmanaged code then consider it to be responsible for the instability. Writing off the PC and shooting it between the disk platters is the quick fix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With