Exception in CoreLab.Oracle.OracleCursor.Finalize()
Exception in CoreLab.Oracle.OracleCursor.Finalize()
We are using OraDirect .NET 3.50.10 in our .Net application and Oracle 9.2.0.4. .Net code that works with Oracle DB is state inside .DLL that we are calling through another .EXE. We are working in Direct mode and Unicode = true. We reading output cursors by OracleDataReader. Sometimes on closing application I am recieving error:
System.ObjectDisposedException was unhandled
Message="Safe handle has been closed"
Source="System"
ObjectName=""
StackTrace:
at System.Net.UnsafeNclNativeMethods.OSSOCK.getsockopt(SafeCloseSocket socketHandle, SocketOptionLevel optionLevel, SocketOptionName optionName, Int32& optionValue, Int32& optionLength)
at System.Net.Sockets.Socket.GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
at System.Net.Sockets.TcpClient.numericOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
at System.Net.Sockets.TcpClient.get_ReceiveTimeout()
at CoreLab.Oracle.g.a(Int32 A_0)
at CoreLab.Oracle.b.a()
at CoreLab.Oracle.a5.q()
at CoreLab.Oracle.OracleCursor.Finalize()
The problem occurs occationally and hard reprodusable. Do you have any idea what is the reason of this exception?
System.ObjectDisposedException was unhandled
Message="Safe handle has been closed"
Source="System"
ObjectName=""
StackTrace:
at System.Net.UnsafeNclNativeMethods.OSSOCK.getsockopt(SafeCloseSocket socketHandle, SocketOptionLevel optionLevel, SocketOptionName optionName, Int32& optionValue, Int32& optionLength)
at System.Net.Sockets.Socket.GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
at System.Net.Sockets.TcpClient.numericOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
at System.Net.Sockets.TcpClient.get_ReceiveTimeout()
at CoreLab.Oracle.g.a(Int32 A_0)
at CoreLab.Oracle.b.a()
at CoreLab.Oracle.a5.q()
at CoreLab.Oracle.OracleCursor.Finalize()
The problem occurs occationally and hard reprodusable. Do you have any idea what is the reason of this exception?
Some details: reading output stored procedure cursors implemented like this:
GlobalData.DataBaseAccess.oraConnection.Open();
GlobalData.DataBaseAccess.getDescriptiveCommand.ExecuteNonQuery();
CoreLab.Oracle.OracleDataReader dataReader =
((OracleCursor)getDescriptiveCommand.Parameters ["cursorName"].OracleValue).GetDataReader();
while (dataReader.Read())
{
}
dataReader.Close();
May be the problem is somewhere here? When I am commenting this code the exception is disappear.
GlobalData.DataBaseAccess.oraConnection.Open();
GlobalData.DataBaseAccess.getDescriptiveCommand.ExecuteNonQuery();
CoreLab.Oracle.OracleDataReader dataReader =
((OracleCursor)getDescriptiveCommand.Parameters ["cursorName"].OracleValue).GetDataReader();
while (dataReader.Read())
{
}
dataReader.Close();
May be the problem is somewhere here? When I am commenting this code the exception is disappear.