Search code examples
sqlvisual-studio-2013exceptionef-code-firstsql-server-ce

SQL Server CE System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt


enter image description here

How to handle such an error, even though we have written general exception in catch?


Solution

  • You are most likely using the same DbContext across threads, and that is not supported, as DbContext and SqlCeConnection are not thread safe