We encountered  a doubly freed "C" pointer after calling sqlite3_exec
in my custom version of the Microsoft.Data.Sqlite C# method
SqliteCommand::ExecuteAnReader which does not call the parent C# class
method DbCommand::ExecuteReader which does not use a C# NativeMethod. The
C# NativeMethod class has a method for handling garbage collection which I
bypasses by calling public virtual void
SqliteCommand::ExecuteAnReader().
After using sqlite3_exec to insert 935 rows into the Sqlite3 Vendors
table, we got the following error message:  *** Error in
`/opt/monodevelop/bin/mono': free(): invalid pointer: 0x0000000007b2e018 ***
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_marshal_free
(intptr) <IL 0x0000d, 0xffffffff>
  at (wrapper managed-to-native)
Microsoft.Data.Sqlite.SqliteCommand.sqlite3_exec
(Microsoft.Data.Sqlite.Interop.Sqlite3Handle,string,Microsoft.Data.Sqlite.SqliteCommand/FooCallbackType,intptr,string&)
<IL 0x0007e, 0xffffffff>
  at Microsoft.Data.Sqlite.SqliteCommand.ExecuteAnReader () <IL 0x00020,
0x00063>
  at XMLConverter.Program.InsertTable (string,string,int) <IL 0x00060,
0x0013b>
  at XMLConverter.Program.Main (string[]) <IL 0x001f2, 0x0062f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <IL 0x00050,
0xffffffff>                                     How might we workaround
this problem in C# or alternatively should we investigate the C language
function how to add additional C language code around sqlite3_exec()? Any
help is greatlly appreciated.

Reply via email to