Hi Carlos,

I've found a bug in the way how exeptions are handled in method
FbDataAdapter.Update(DataRow[], DataTableMapping). There is try - catch
block and within it are updated parameter values etc. In the "catch" part
potential exception is caught but there is no "throw" clause and the program
continues even after exception was fired.

It looks like an intention to do it this way (i.e. the exception is not
thrown immediately but it is thrown later at the end of method) but it
causes IMHO very unpleasant behaviour.

You can simulate it with any project where is FbDataAdapter used and its
UpdateCommand is assigned and has at least one input parameter:
1) Change the 'SourceColumn' property to any non-sense value like e.g.
"MY_NON_EXISTING_COLUMN".
2) compile project, run it, update data in corresponding dataset in order to
launch FbDataAdapter.Update method.
3) FbDataAdapter.Update method will fail on calling

this.UpdateParameterValues(command, statementType, row, tableMapping);

It is the first command in the try-catch block I have mentioned before. It
throws an ArgumentNullException with message "'dataType' argument cannot be
null. Parameter name: dataType" (may be that you do not get the "dataType"
word, it is not relevant).

4) The exception is caught and it is stored in the variable called
updateException for later use
5) The program now continues and it fails again on the next step when
evaluating the condition

if (updatingArgs.Status == UpdateStatus.Continue)

It is because updatingArgs is null - it was not initialized due to previous
exception.

6) The unpleasant result is that new non-sense exception
NullReferenceException is thrown that has nothing to do with the real
problem. I (as the user of the provider) have to search and trace into the
provider code to find out what is the problem, because there is no chance to
understand what happened.


The conclusion:
1) Could you please correct the exception handling in this method in order
to obtain always the correct exception with correct message?
2) And next - when I found the "correct" message "dataType' argument cannot
be null. Parameter name: dataType" I was bit confused because in my program
is no such parameter! IMHO there must be another bug when generating this
exception message.

Regards Marek




_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to