4

I have application which do multiple accessing to DB (SqlCompact 4.0). And sometimes application crashed with the next record in Event Viewer.

Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at System.Data.SqlServerCe.NativeMethodsHelper.SafeRelease(IntPtr ByRef)
   at System.Data.SqlServerCe.NativeMethods.SafeRelease(IntPtr ByRef)
   at System.Data.SqlServerCe.SqlCeCommand.ReleaseNativeInterfaces()
   at System.Data.SqlServerCe.SqlCeCommand.Dispose(Boolean)
   at System.Data.SqlServerCe.SqlCeCommand.Finalize()

P.S. Multiple accessing means that there are N tasks(Task Parallel Library) which add records in DB.

Yara
  • 4,441
  • 6
  • 42
  • 62
  • thread synchronisation issue....? – Mitch Wheat Feb 22 '11 at 08:58
  • You must have a SqlCeConnection per thread, and make sure to release all Commands, as they are not thread safe – ErikEJ Feb 22 '11 at 09:20
  • If it is synchronize issue, then how to check locked or unlocked DB from task? – Yara Feb 22 '11 at 09:26
  • ErikEJ, yes I have SqlCeConection per thread (task) but it does not make sense, issue still appears .. – Yara Feb 22 '11 at 09:28
  • To be clear here, did you really download the new SqlCe 4 (still CTP ?) Or do you use the SqlCe installed with VS2010? Check the version of the System.Data.SqlServerCe.dll – H H Feb 22 '11 at 17:03
  • 1
    I've got the same issues right now - but I let EF handle the connections so not sure how to really check this – Random Dev Feb 23 '12 at 07:06
  • Please let me know if you ever got to the bottom of this - I'm having a similar problem (http://stackoverflow.com/questions/11825209/sql-server-compact-edition-4-accessviolationexception). – Tom Hunter Aug 06 '12 at 14:11

0 Answers0