Page 1 of 1

OracleLoader: weird error handling

Posted: Tue 06 May 2014 08:07
by Dennis Wanke
As we ran into this issue http://forums.devart.com/viewtopic.php?f=1&t=29508, we noticed following weird behavior of OracleLoader:
  • If Close() is called implicitly during instance disposal (by means of “using” construct), the errors simply get swallowed (no exception is thrown up to the caller), although exceptions still get thrown and caught internally, as one can see under debugger; looks like the implementation of Dispose() lacks GC.SuppressFinalize(), or sort of
  • if OracleException is thrown due to constraints violation, its message contains a useless generic description ("ORA-24381: error(s) in array DML") instead of real error messages; see also http://forums.devart.com/viewtopic.php?f=1&t=29512
  • the Error event is not triggered if not subscribed for immediately after an instance is created, e.g. after CreateColumns() has been called
  • when Error event is called, the first argument of its delegate (“sender”) is not the loader instance (as one should expect), but some internal class with an obfuscated name (like “Devart.Data.Oracle.s”)

Re: OracleLoader: weird error handling

Posted: Thu 08 May 2014 13:48
by Pinturiccio
Dennis Wanke wrote:If Close() is called implicitly during instance disposal (by means of “using” construct), the errors simply get swallowed (no exception is thrown up to the caller), although exceptions still get thrown and caught internally, as one can see under debugger; looks like the implementation of Dispose() lacks GC.SuppressFinalize(), or sort of
We have reproduced the issue. We will investigate it and post here about the results as soon as possible.
Dennis Wanke wrote: if OracleException is thrown due to constraints violation, its message contains a useless generic description ("ORA-24381: error(s) in array DML") instead of real error messages; see also http://forums.devart.com/viewtopic.php?f=1&t=29512
When you use array binding, several exception can be generated. The "ORA-24381: error(s) in array DML" message is a standard message for the array binding feature. You can get information about all the errors occurred when performing array binding using the Error event. For more information, please refer to http://www.devart.com/dotconnect/oracle ... or_EV.html
Here is an example of using this event with array binding.

Code: Select all

static void Main(string[] args)
{
    OracleConnection connection = new OracleConnection("your connection string");
    connection.Open();

    OracleLoader loader = new OracleLoader();
    loader.Connection = connection;
    loader.Error += new OracleLoaderErrorEventHandler(loader_Error);
    loader.TableName = "table name";
    loader.CreateColumns();

    loader.Open();

    // Perform operations with Oracle Loader
    loader.Close();

}

static void loader_Error(object sender, OracleLoaderErrorEventArgs e)
{
    if (e.Exception.Errors == null)
        Console.WriteLine(e.Exception.Message);
    else
        foreach (OracleError error in e.Exception.Errors)
            Console.WriteLine(error.Message);
    e.Ignore = true;
}
Dennis Wanke wrote:the Error event is not triggered if not subscribed for immediately after an instance is created, e.g. after CreateColumns() has been called
We have reproduced the issue. We will investigate it and post here about the results as soon as possible.
Dennis Wanke wrote:when Error event is called, the first argument of its delegate (“sender”) is not the loader instance (as one should expect), but some internal class with an obfuscated name (like “Devart.Data.Oracle.s”)
We have reproduced this issue as well. We will investigate it and post here about the results as soon as possible.

Re: OracleLoader: weird error handling

Posted: Wed 14 May 2014 14:24
by Pinturiccio
We have fixed the following bugs:
1. The bug with wrong type of a sender object in OracleLoaderErrorEventHandler.
2. The bug with Error event of OracleLoader class not happening if it is initialized after CreateColumn method.
3. The bug with not throwing exception when OracleLoader object is disposed without explicit call to Close().

We will post here when the corresponding build of dotConnect for Oracle is available for download.

Re: OracleLoader: weird error handling

Posted: Thu 15 May 2014 14:27
by Pinturiccio
New build of dotConnect for Oracle 8.3.161 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=29592

Re: OracleLoader: weird error handling

Posted: Fri 16 May 2014 19:39
by Dennis Wanke
This seems to be working as expected with 8.3.161.