Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at Oracle.DataAccess.Client.OracleParameter.SetStatus(Int32)
at Oracle.DataAccess.Client.OracleParameter.PreBind(Oracle.DataAccess.Client.OracleConnection, IntPtr, Int32, Boolean)
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
My application is crashing with this exception. context is: We are trying to execute a stored procedure that accepts two parameters, we are using name binding for parameters in command text.
Example:
OraCommand.CommandText = "begin LOAD_UTILS.TRUNCATE_TABLE(:a1,:a2); end;"
OraCommand.Parameters.Add(New OracleParameter("a1", OracleDbType.Varchar2, 1000))
OraCommand.Parameters(0).Direction = ParameterDirection.Input
OraCommand.Parameters(0).Value = params(2)
OraCommand.Parameters.Add(New OracleParameter("a2", OracleDbType.Varchar2, 1000))
OraCommand.Parameters(1).Direction = ParameterDirection.Input
OraCommand.Parameters(1).Value = params(3)
The oddity i have observed is, we run these statements in a for loop for a certan number of retries incase if there are any errors, OraCommand is an instance variable, so parameters collection is not getting cleared.
In iteration#1: paratmeters a1, a2 are getting added
In iteration#2: the first two parameters are already there, and again we are adding parameters with names a1, and a2.
...
Am not seeing the issue, when i clear the parameter collection at the start of every iteration, but i am not able to come up with a theory that is causing the issue here, any thoughts?
@Mrinal Kamboj You are right, code is in VB.NET; The exception was thrown when it tries to execute ExecuteNonQuery. I tried WinDbg, and this what it gives: