I get an System.AccessViolationException when using the OracleObject data type. I'm working with SDO_GEOMETRY objects, the column contains POLYGON geometries or NULL.
I tried this out on Vista x86 and Win7 x64, with dotConnect Express (latest version, v6.30.185 and also older versions from 2011), Oracle Client 11.2.0.1 32bit, Oracle Server 11.1.0.6 64bit). Target platform is .NET 4 (x86), but the problem also exists in .NET 2.
I first thought it would be a .NET 4 problem, because older versions of our product are working fine. But then I tried dotConnect Express v5.25.49.0: With this version everything works fine!
So there is definitely a problem in your code. I also tried out ODP.NET: no problems at all.
This is the StackTrace:
OciDynamicType.nativeOCIObjectFree(HandleRef , HandleRef , HandleRef , In
t16 )
OciDynamicType.OCIObjectFree(HandleRef , HandleRef , HandleRef , Int16 )
Devart.Data.Oracle.h.a(IntPtr A_0)
Devart.Data.Oracle.ab.l()
Devart.Data.Oracle.ab.c(Int32 A_0)
Devart.Data.Oracle.ab.b(Int32 A_0)
Devart.Data.Oracle.OracleDataReader.Read()
I was not able to reproduce the behavior with newly created data, but this is a small piece of code that throws the exception (but only with my data):
Code: Select all
var sql = "select GEOMETRY from ...";
var reader = ...;
while(reader.Read())
//Read() throws at same position every time. Slightly changing the sql statement slightly changes the position too...
{
object sdo = reader[0];
}
var sql = "select CASE WHEN GEOMETRY IS NULL THEN SDO_UTIL.FROM_WKTGEOMETRY('POINT (0 0)') ELSE GEOMETRY END from ...";
With this statement also no exception:
var sql = "select GEOMETRY from ... where NOT GEOMETRY IS NULL";
So I assume that there is a memory management problem in the dotConnect provider. The last sdo object seemed to be corrupt, because the debugger showed "a mess" sometimes when I "looked into" the sdo object.
So the NULL values seem to be the cause for this problem.
Note: The GEOMETRY column is often NULL because the table is LEFT JOINed (so no matching record exists in the GEOMETRY column's table)
Hope you can fix this!
Regards,
Markus